Comparing version 0.4.9 to 0.4.10
@@ -8,2 +8,6 @@ var fs = require('fs'); | ||
output.on('close', function() { | ||
console.log('archiver has been finalized and the output file descriptor has closed.'); | ||
}); | ||
archive.on('error', function(err) { | ||
@@ -22,3 +26,3 @@ throw err; | ||
archive.finalize(function(err, written) { | ||
archive.finalize(function(err, bytes) { | ||
if (err) { | ||
@@ -28,3 +32,3 @@ throw err; | ||
console.log(written + ' total bytes written'); | ||
console.log(bytes + ' total bytes'); | ||
}); |
@@ -10,2 +10,6 @@ var fs = require('fs'); | ||
output.on('close', function() { | ||
console.log('archiver has been finalized and the output file descriptor has closed.'); | ||
}); | ||
archive.on('error', function(err) { | ||
@@ -24,3 +28,3 @@ throw err; | ||
archive.finalize(function(err, written) { | ||
archive.finalize(function(err, bytes) { | ||
if (err) { | ||
@@ -30,3 +34,3 @@ throw err; | ||
console.log(written + ' total bytes written'); | ||
console.log(bytes + ' total bytes'); | ||
}); |
@@ -8,2 +8,6 @@ var fs = require('fs'); | ||
output.on('close', function() { | ||
console.log('archiver has been finalized and the output file descriptor has closed.'); | ||
}); | ||
archive.on('error', function(err) { | ||
@@ -22,3 +26,3 @@ throw err; | ||
archive.finalize(function(err, written) { | ||
archive.finalize(function(err, bytes) { | ||
if (err) { | ||
@@ -28,3 +32,3 @@ throw err; | ||
console.log(written + ' total bytes written'); | ||
console.log(bytes + ' total bytes'); | ||
}); |
@@ -49,3 +49,8 @@ /** | ||
function onend(sourceBuffer) { | ||
function onend(err, sourceBuffer) { | ||
if (err) { | ||
callback(err); | ||
return; | ||
} | ||
sourceBuffer = sourceBuffer || false; | ||
@@ -68,13 +73,6 @@ file.size = sourceBuffer.length || 0; | ||
if (file.sourceType === 'buffer') { | ||
onend(source); | ||
onend(null, source); | ||
} else if (file.sourceType === 'stream') { | ||
util.collectStream(source, function(err, buf) { | ||
if (err) { | ||
callback(err); | ||
return; | ||
} | ||
onend(buf); | ||
}); | ||
util.collectStream(source, onend); | ||
} | ||
}; |
@@ -68,3 +68,3 @@ /** | ||
buf.write(val, offset); | ||
buf.write(val, offset); | ||
@@ -161,6 +161,9 @@ offset += value.len; | ||
var max = MAXNUM[len] || 0; | ||
// tar spec calls for field length - 1 + null (\0) | ||
var maxLen = len - 1; | ||
var maxVal = MAXNUM[len] || 0; | ||
if (num > max || num < 0) { | ||
// need an extended header if negative or too big. someday just not today.. | ||
if (num < 0 || num > maxVal) { | ||
// need an extended header if negative or too big. needs implemented.. | ||
throw new Error('tar extended header required but not implemented'); | ||
} | ||
@@ -170,11 +173,13 @@ | ||
if (num < MAXNUM[len - 1]) { | ||
str += ' '; | ||
} | ||
// if short enough should have a space before null (\0) | ||
// derived from node-tar logic but needs confirmed by spec | ||
// if (num < MAXNUM[maxLen]) { | ||
// str += ' '; | ||
// } | ||
if (str.length < len) { | ||
str = util.repeat('0', len - str.length) + str; | ||
if (str.length < maxLen) { | ||
str = util.repeat('0', maxLen - str.length) + str; | ||
} | ||
return str; | ||
return str.substr(0, maxLen) + '\0'; | ||
}; | ||
@@ -181,0 +186,0 @@ |
{ | ||
"name": "archiver", | ||
"version": "0.4.9", | ||
"version": "0.4.10", | ||
"description": "Creates Archives (ZIP) via Node Streams.", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/ctalkington/node-archiver", |
@@ -1,2 +0,2 @@ | ||
# Archiver v0.4.9 [![Build Status](https://secure.travis-ci.org/ctalkington/node-archiver.png?branch=master)](http://travis-ci.org/ctalkington/node-archiver) | ||
# Archiver v0.4.10 [![Build Status](https://secure.travis-ci.org/ctalkington/node-archiver.png?branch=master)](http://travis-ci.org/ctalkington/node-archiver) | ||
@@ -27,5 +27,5 @@ Creates Archives (Zip, Tar) via Node Streams. Depends on Node's built-in zlib module for compression available since version 0.6.3. | ||
#### #finalize(callback(err, bytesWritten)) | ||
#### #finalize(callback(err, bytes)) | ||
Finalizes the instance. When the instance's stream has finished emitting, the callback is fired. | ||
Finalizes the instance. When the instance's stream has finished emitting, the callback is fired. This generally doesn't correspond to the end of the destination stream; though a solution to track the destination stream may come in a future release. | ||
@@ -92,2 +92,3 @@ ## Zip | ||
- [Changelog](https://github.com/ctalkington/node-archiver/blob/master/CHANGELOG) | ||
- [Archive Formats](https://github.com/ctalkington/node-archiver/blob/master/formats) | ||
- [Contributing](https://github.com/ctalkington/node-archiver/blob/master/CONTRIBUTING.md) | ||
@@ -94,0 +95,0 @@ - [MIT License](https://github.com/ctalkington/node-archiver/blob/master/LICENSE-MIT) |
@@ -68,3 +68,3 @@ /*global before,describe,it */ | ||
testStream.on('close', function() { | ||
assert.equal(testStream.digest, '3a8a9ff17087129cc05dc88be86573ecf3f9ca56'); | ||
assert.equal(testStream.digest, 'bc84fec33e7a4f6c8777cabd0beba503a7bce331'); | ||
done(); | ||
@@ -85,3 +85,3 @@ }); | ||
testStream.on('close', function() { | ||
assert.equal(testStream.digest, '3e3271c503deeba9abe5031df6bca636f1eb115b'); | ||
assert.equal(testStream.digest, 'b3bf662968c87989431a25b2f699eae213392e82'); | ||
done(); | ||
@@ -102,3 +102,3 @@ }); | ||
testStream.on('close', function() { | ||
assert.equal(testStream.digest, '1437ef391a7c2c0de180bddff21b98c2f9778331'); | ||
assert.equal(testStream.digest, '0c4e2a79d0d2c41ae5eb2e1e70d315a617583e4d'); | ||
done(); | ||
@@ -121,3 +121,3 @@ }); | ||
testStream.on('close', function() { | ||
assert.equal(testStream.digest, 'aeb2496b2bd7458931ba942dba2b4bf28cbc187c'); | ||
assert.equal(testStream.digest, 'c1efbfbdc9a49979a6e02b4009003de533fcda48'); | ||
done(); | ||
@@ -143,3 +143,3 @@ }); | ||
testStream.on('close', function() { | ||
assert.equal(testStream.digest, '4f9f572817a1f34d0d33b949c959739965e50fa6'); | ||
assert.equal(testStream.digest, 'f4f7b53f8ee4c7124298695bffbacfa9e9c0a99f'); | ||
done(); | ||
@@ -146,0 +146,0 @@ }); |
@@ -81,3 +81,3 @@ /*global before,describe,it */ | ||
assert.equal(actual.mtime, testDateEpoch); | ||
assert.equal(actual.checksum, 5730); | ||
assert.equal(actual.checksum, 5490); | ||
assert.equal(actual.type, '0'); | ||
@@ -106,4 +106,3 @@ assert.equal(actual.linkName, ''); | ||
it('should convert octal strings to numeric values', function() { | ||
assert.equal(thing._parseNumeric('21'), 17); | ||
assert.equal(thing._parseNumeric('0021'), 17); | ||
assert.equal(thing._parseNumeric('00000021'), 17); | ||
}); | ||
@@ -113,10 +112,5 @@ }); | ||
describe('#_prepNumeric(num, len)', function() { | ||
it('should convert numeric values to octal strings', function() { | ||
assert.equal(thing._prepNumeric(17, 2), '21'); | ||
it('should convert numeric values to octal strings, padding when needed', function() { | ||
assert.equal(thing._prepNumeric(17, 7), '000021\0'); | ||
}); | ||
it('should zero pad when needed', function() { | ||
assert.equal(thing._prepNumeric(17, 4), '0021'); | ||
}); | ||
}); | ||
@@ -123,0 +117,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
104290
40
1996
100