Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Update README to reflect writing API changes

  • Loading branch information...
commit 6c8d10bbbc3b0808baea5bc79a3cc08ee445c8b2 1 parent 2d77bca
@pixelglow authored
Showing with 31 additions and 19 deletions.
  1. +31 −19 README.markdown
View
50 README.markdown
@@ -43,32 +43,44 @@ Reading an existing zip file:
Writing a new zip file:
ZZMutableArchive* newArchive = [ZZMutableArchive archiveWithContentsOfURL:[NSURL fileURLWithPath:@"/tmp/new.zip"]];
- newArchive.entries =
- @[
- [ZZArchiveEntry archiveEntryWithFileName:@"first.text"
- compress:YES
- dataBlock:^{ return [@"hello, world" dataUsingEncoding:NSUTF8StringEncoding]; }]
- ];
+ [newArchive updateEntries:
+ @[
+ [ZZArchiveEntry archiveEntryWithFileName:@"first.text"
+ compress:YES
+ dataBlock:^(NSError** error)
+ {
+ return [@"hello, world" dataUsingEncoding:NSUTF8StringEncoding];
+ }]
+ ]
+ error:nil];
Writing a new zip file containing a directory:
ZZMutableArchive* newArchive = [ZZMutableArchive archiveWithContentsOfURL:[NSURL fileURLWithPath:@"/tmp/new.zip"]];
- newArchive.entries =
- @[
- [ZZArchiveEntry archiveEntryWithDirectoryName:@"folder/"],
- [ZZArchiveEntry archiveEntryWithFileName:@"folder/first.text"
- compress:YES
- dataBlock:^{ return [@"hello, world" dataUsingEncoding:NSUTF8StringEncoding]; }]
- ];
-
+ [newArchive updateEntries:
+ @[
+ [ZZArchiveEntry archiveEntryWithDirectoryName:@"folder/"],
+ [ZZArchiveEntry archiveEntryWithFileName:@"folder/first.text"
+ compress:YES
+ dataBlock:^(NSError** error)
+ {
+ return [@"hello, world" dataUsingEncoding:NSUTF8StringEncoding];
+ }]
+ ]
+ error:nil];
+
Updating an existing zip file:
ZZMutableArchive* oldArchive = [ZZMutableArchive archiveWithContentsOfURL:[NSURL fileURLWithPath:@"/tmp/old.zip"]];
- oldArchive.entries = [oldArchive.entries arrayByAddingObject:
- [ZZArchiveEntry archiveEntryWithFileName:@"second.text"
- compress:YES
- dataBlock:^{ return [@"bye, world" dataUsingEncoding:NSUTF8StringEncoding]; }]
- ];
+ [oldArchive updateEntries:
+ [oldArchive.entries arrayByAddingObject:
+ [ZZArchiveEntry archiveEntryWithFileName:@"second.text"
+ compress:YES
+ dataBlock:^(NSError** error)
+ {
+ return [@"bye, world" dataUsingEncoding:NSUTF8StringEncoding];
+ }]]
+ error:nil];
Require
-------
Please sign in to comment.
Something went wrong with that request. Please try again.