Skip to content

Commit

Permalink
Updated readme to reflect API changes
Browse files Browse the repository at this point in the history
  • Loading branch information
abbeycode committed Aug 4, 2015
1 parent fb4ce96 commit 4a4c239
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,30 @@ I'm always open to improvements, so please submit your pull requests, or [create
# Example Usage

```Objective-C
URKArchive *archive = [URKArchive rarArchiveAtPath:@"An Archive.rar"];
NSError *archiveError = nil;
URKArchive *archive = [[URKArchive alloc] initWithPath:@"An Archive.rar" error:&archiveError];
NSError *error = nil;
```
## Listing the file names in an archive
```Objective-C
NSArray *filesInArchive = [archive listFilenames:&error];
NSArray<String*> *filesInArchive = [archive listFilenames:&error];
for (NSString *name in filesInArchive) {
NSLog(@"Archived file: %@", name);
}
```

## Listing the file details in an archive
```Objective-C
NSArray *fileInfosInArchive = [archive listFileInfo:&error];
NSArray<URKFileInfo*> *fileInfosInArchive = [archive listFileInfo:&error];
for (URKFileInfo *info in fileInfosInArchive) {
NSLog(@"Archive name: %@ | File name: %@ | Size: %lld", info.archiveName, info.filename, info.uncompressedSize);
}
```
## Working with passwords
```Objective-C
NSArray *fileInfosInArchive = [archive listFileInfo:&error];
NSArray<URKFileInfo*> *fileInfosInArchive = [archive listFileInfo:&error];
if (archive.isPasswordProtected) {
NSString *givenPassword = // prompt user
archive.password = givenPassword
Expand Down

0 comments on commit 4a4c239

Please sign in to comment.