Permalink
Browse files

added API.md

  • Loading branch information...
bjouhier committed Feb 23, 2012
1 parent a367ae4 commit 00548df7faae7ecee08b5157253b0e772f128836
Showing with 28 additions and 0 deletions.
  1. +28 −0 API.md
View
28 API.md
@@ -0,0 +1,28 @@
+
+# node-native-zip module
+
+Simple API to create a zip archive. No extenal dependencies (except streamline.js)
+
+* `archive = new zip.Zip(outStream, options)`
+ Creates a zip archive.
+ Uses _deflate_ compression by default. You can override this by passing
+ options = { zipMethod: zip.store }
+* `archive.add(_, entry)`
+ Adds an entry to the archive.
+ If the entry is `{ name: "...", path: "..." }`,
+ the `path` file or directory (and all its contents) is added to the archive.
+ If the entry is `{ name: "...", data: "..." }`,
+ the `data` buffer is added to the archive.
+ You may also specify a `date` in the entry.
+ If you pass a directory `path`, you can also pass a `filter` function in the entry.
+ The `filter` function will be called as `filter(filename, parentEntry)`.
+ You can also pass an array of entries instead of a single entry.
+
+ Returns `this` for chaining
+* `archive.finish(_)`
+ Writes the trailer at the end of the archive.
+ Returns `this` for chaining.
+* `zipMethod: zip.store`
+ _store_ method (no compression)
+* `zipMethod: zip.deflate`
+ _deflate_ method (standard compression)

0 comments on commit 00548df

Please sign in to comment.