Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

reviewed API.md

  • Loading branch information...
commit 8b66d2f14948a8fde976431cac9a0247b3b5ee26 1 parent 00548df
@bjouhier bjouhier authored
Showing with 16 additions and 8 deletions.
  1. +8 −4 API.md
  2. +8 −4 janzip/janzip.js
View
12 API.md
@@ -1,12 +1,13 @@
# node-native-zip module
-Simple API to create a zip archive. No extenal dependencies (except streamline.js)
+Simple API to create a zip archive. No external dependencies (except streamline.js).
-* `archive = new zip.Zip(outStream, options)`
+* `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 }
+ `options = { zipMethod: zip.store }`
+
* `archive.add(_, entry)`
Adds an entry to the archive.
If the entry is `{ name: "...", path: "..." }`,
@@ -17,12 +18,15 @@ Simple API to create a zip archive. No extenal dependencies (except streamline.j
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)
+
View
12 janzip/janzip.js
@@ -18,12 +18,13 @@ var zlib = require("zlib");
///
/// # node-native-zip module
///
-/// Simple API to create a zip archive. No extenal dependencies (except streamline.js)
+/// Simple API to create a zip archive. No external dependencies (except streamline.js).
///
-/// * `archive = new zip.Zip(outStream, options)`
+/// * `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 }
+/// `options = { zipMethod: zip.store }`
+///
exports.Zip = function(outStream, options) {
// auto-wrap outStream with streamline stream
var os = outStream.emitter ? outStream : new streams.WritableStream(outStream);
@@ -126,8 +127,8 @@ exports.Zip = function(outStream, options) {
/// 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
+ ///
this.add = function(_, entry) {
if (Array.isArray(entry)) {
flows.each(_, entry, this.add.bind(this));
@@ -164,6 +165,7 @@ exports.Zip = function(outStream, options) {
/// * `archive.finish(_)`
/// Writes the trailer at the end of the archive.
/// Returns `this` for chaining.
+ ///
this.finish = function(_) {
var totalFileLength = fileOffset;
@@ -192,6 +194,7 @@ exports.Zip = function(outStream, options) {
/// * `zipMethod: zip.store`
/// _store_ method (no compression)
+///
exports.store = {
indicator: [0x00, 0x00],
compress: function(content, _) {
@@ -201,6 +204,7 @@ exports.store = {
/// * `zipMethod: zip.deflate`
/// _deflate_ method (standard compression)
+///
exports.deflate = {
indicator: [0x08, 0x00],
compress: function(content, _) {
Please sign in to comment.
Something went wrong with that request. Please try again.