Comparing version 0.4.3 to 0.4.4
@@ -13,2 +13,3 @@ /** | ||
var Transform = require('stream').Transform || require('readable-stream/transform'); | ||
var PassThrough = require('stream').PassThrough || require('readable-stream/passthrough'); | ||
@@ -97,6 +98,15 @@ var util = require('../util'); | ||
Archiver.prototype.append = function(source, data, callback) { | ||
var sourceCompatMode = false; | ||
var sourceCompat; | ||
if (typeof source === 'string') { | ||
source = new Buffer(source, 'utf-8'); | ||
} else if (source && typeof source.pause === 'function' && !source._readableState) { | ||
source.pause(); | ||
} else if (util.isStream(source)) { | ||
if (typeof source.pause === 'function' && !source._readableState) { | ||
source.pause(); | ||
} else if (!source._readableState) { | ||
sourceCompatMode = true; | ||
sourceCompat = new PassThrough(); | ||
source.pipe(sourceCompat); | ||
} | ||
} | ||
@@ -111,3 +121,3 @@ | ||
data: data, | ||
source: source, | ||
source: (sourceCompatMode) ? sourceCompat : source, | ||
callback: callback | ||
@@ -114,0 +124,0 @@ }); |
@@ -94,2 +94,4 @@ /** | ||
return new CRC32(); | ||
}; | ||
}; | ||
exports.CRC32 = CRC32; |
{ | ||
"name": "archiver", | ||
"version": "0.4.3", | ||
"version": "0.4.4", | ||
"description": "Creates Archives (ZIP) via Node Streams.", | ||
@@ -28,3 +28,3 @@ "homepage": "https://github.com/ctalkington/node-archiver", | ||
"scripts": { | ||
"test": "nodeunit test/simple", | ||
"test": "mocha --reporter dot", | ||
"bench": "node benchmark/simple/pack-zip.js" | ||
@@ -36,3 +36,4 @@ }, | ||
"devDependencies": { | ||
"nodeunit": "~0.7.4", | ||
"chai": "~1.6.0", | ||
"mocha": "~1.9.0", | ||
"rimraf": "~2.1.4", | ||
@@ -39,0 +40,0 @@ "mkdirp": "~0.3.5", |
@@ -1,4 +0,4 @@ | ||
# Archiver v0.4.3 [![Build Status](https://secure.travis-ci.org/ctalkington/node-archiver.png?branch=master)](http://travis-ci.org/ctalkington/node-archiver) | ||
# Archiver v0.4.4 [![Build Status](https://secure.travis-ci.org/ctalkington/node-archiver.png?branch=master)](http://travis-ci.org/ctalkington/node-archiver) | ||
Creates Archives (Zip, Tar) via Node Streams. Depends on Node's build-in zlib module for compression available since version 0.6.3. | ||
Creates Archives (Zip, Tar) via Node Streams. Depends on Node's built-in zlib module for compression available since version 0.6.3. | ||
@@ -113,2 +113,2 @@ ## Install | ||
This project's code is licensed under the MIT license. see [LICENSE-MIT](https://github.com/ctalkington/node-archiver/blob/master/LICENSE-MIT). | ||
This project's code is licensed under the MIT license. see [LICENSE-MIT](https://github.com/ctalkington/node-archiver/blob/master/LICENSE-MIT). |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
68826
37
1622
114
5
9