Socket
Socket
Sign inDemoInstall

archiver

Package Overview
Dependencies
Maintainers
1
Versions
83
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

archiver - npm Package Compare versions

Comparing version 0.4.4 to 0.4.5

6

lib/archiver/zip.js

@@ -28,3 +28,3 @@ /**

if (options.level && options.level > 0) {
if (options.level && options.level >= 0) {
options.zlib.level = options.level;

@@ -94,2 +94,6 @@ delete options.level;

if (this.options.zlib && this.options.zlib.level === 0) {
file.store = true;
}
if (typeof file.name !== 'string' || file.name.length === 0) {

@@ -96,0 +100,0 @@ callback(new Error('File name is empty or not a valid string value'));

@@ -17,2 +17,11 @@ /**

var objectTypes = {
'boolean': false,
'function': true,
'object': true,
'number': false,
'string': false,
'undefined': false
};
util.cleanBuffer = function(length) {

@@ -84,17 +93,33 @@ var buffer = new Buffer(length);

util.defaults = function(obj) {
obj = obj || {};
var args = Array.prototype.slice.call(arguments, 1);
util.defaults = function(object, source) {
object = object || {};
args.forEach(function(source) {
if (source) {
for (var prop in source) {
if (obj[prop] == null) {
obj[prop] = source[prop];
var index;
var iterable = object;
var result = iterable;
var args = arguments;
var argsIndex = 0;
var argsLength = args.length;
while (++argsIndex < argsLength) {
iterable = args[argsIndex];
if (iterable && objectTypes[typeof iterable]) {
var ownIndex = -1;
var ownProps = objectTypes[typeof iterable] && util.keys(iterable);
var length = ownProps ? ownProps.length : 0;
while (++ownIndex < length) {
index = ownProps[ownIndex];
if (typeof result[index] === 'undefined' || result[index] == null) {
result[index] = iterable[index];
} else if (util.isObject(result[index]) && util.isObject(iterable[index])) {
result[index] = util.defaults(result[index], iterable[index]);
}
}
}
});
}
return obj;
return result;
};

@@ -125,2 +150,18 @@

util.keys = function(object) {
if (!util.isObject(object)) {
return [];
}
return Object.keys(object);
};
util.isObject = function(value) {
// check if the value is the ECMAScript language type of Object
// http://es5.github.com/#x8
// and avoid a V8 bug
// http://code.google.com/p/v8/issues/detail?id=2291
return !!(value && objectTypes[typeof value]);
};
util.isStream = function(source) {

@@ -127,0 +168,0 @@ return (source instanceof stream.Stream);

2

package.json
{
"name": "archiver",
"version": "0.4.4",
"version": "0.4.5",
"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.4 [![Build Status](https://secure.travis-ci.org/ctalkington/node-archiver.png?branch=master)](http://travis-ci.org/ctalkington/node-archiver)
# Archiver v0.4.5 [![Build Status](https://secure.travis-ci.org/ctalkington/node-archiver.png?branch=master)](http://travis-ci.org/ctalkington/node-archiver)

@@ -3,0 +3,0 @@ Creates Archives (Zip, Tar) via Node Streams. Depends on Node's built-in zlib module for compression available since version 0.6.3.

@@ -294,2 +294,24 @@ /*global before,describe,it */

});
it('should STORE files when compression level is zero', function(done) {
var archive = archiver('zip', {
forceUTC: true,
zlib: {
level: 0
}
});
var testStream = new WriteHashStream('tmp/store-level0.zip');
testStream.on('close', function() {
assert.equal(testStream.digest, '09305770a3272cbcd7c151ee267cb1b0075dd29e');
done();
});
archive.pipe(testStream);
archive
.append(binaryBuffer(20000), { name: 'buffer.txt', date: testDate })
.finalize();
});
});

@@ -296,0 +318,0 @@

@@ -174,3 +174,3 @@ /*global describe,it */

describe('defaults(object)', function() {
describe('defaults(object, source)', function() {
it('should default when object key is missing', function() {

@@ -198,2 +198,31 @@ var actual = utils.defaults({ value1: true }, {

});
it('should not default when object value is zero', function() {
var actual = utils.defaults({ value1: 0 }, {
value1: 1
});
assert.deepEqual(actual, {
value1: 0
});
});
it('should support defaulting multiple levels', function() {
var actual = utils.defaults({
level1: {
value1: 0
}
}, {
level1: {
value2: 2
}
});
assert.deepEqual(actual, {
level1: {
value1: 0,
value2: 2
}
});
});
});

@@ -200,0 +229,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc