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.12.0 to 0.13.0

119

lib/modules/core/index.js

@@ -45,5 +45,9 @@ /**

Archiver.prototype._abort = function() {
this._state.aborted = true;
this._queue.kill();
this._statQueue.kill();
this._state.aborted = true;
if (this._queue.idle()) {
this._shutdown();
}
};

@@ -75,6 +79,33 @@

Archiver.prototype._moduleAppend = function(source, data, callback) {
this._module.append(source, data, callback);
if (this._state.aborted) {
callback();
return;
}
this._module.append(source, data, function(err) {
this._task = null;
if (this._state.aborted) {
this._shutdown();
return;
}
if (err) {
this.emit('error', err);
callback();
return;
}
this.emit('entry', data);
this._entries.push(data);
callback();
}.bind(this));
};
Archiver.prototype._moduleFinalize = function() {
if (this._state.aborted) {
return;
}
this._state.finalizing = true;

@@ -87,3 +118,3 @@

} else {
this.emit('error', new Error('format module missing finalize and end method'));
this.emit('error', new Error('module: missing finalize and end method'));
}

@@ -95,2 +126,8 @@

Archiver.prototype._modulePipe = function() {
this._module.on('error', this._onModuleError.bind(this));
this._module.pipe(this);
this._state.modulePiped = true;
};
Archiver.prototype._moduleSupports = function(key) {

@@ -104,2 +141,6 @@ this._module.supports = util.defaults(this._module.supports, {

Archiver.prototype._moduleUnpipe = function() {
this._module.unpipe(this);
};
Archiver.prototype._normalizeEntryData = function(data, stats) {

@@ -164,9 +205,19 @@ data = util.defaults(data, {

Archiver.prototype._onQueueTask = function(task, callback) {
if (this._state.finalizing || this._state.finalized || this._state.aborted) {
callback();
return;
}
this._task = task;
this._moduleAppend(task.source, task.data, callback);
};
this._moduleAppend(task.source, task.data, function(err, entry) {
this._task = null;
Archiver.prototype._onStatQueueTask = function(task, callback) {
if (this._state.finalizing || this._state.finalized || this._state.aborted) {
callback();
return;
}
if (err) {
this.emit('error', err);
fs.stat(task.filepath, function(err, stats) {
if (this._state.aborted) {
callback();

@@ -176,13 +227,2 @@ return;

entry = entry || task.data;
this.emit('entry', entry);
this._entries.push(entry);
callback();
}.bind(this));
};
Archiver.prototype._onStatQueueTask = function(task, callback) {
fs.stat(task.filepath, function(err, stats) {
if (err) {

@@ -207,2 +247,19 @@ this.emit('error', err);

Archiver.prototype._processFile = function(source, data, callback) {
this.emit('error', new Error('method not implemented'));
};
Archiver.prototype._shutdown = function() {
this._moduleUnpipe();
this.end();
};
Archiver.prototype._transform = function(chunk, encoding, callback) {
if (chunk) {
this._pointer += chunk.length;
}
callback(null, chunk);
};
Archiver.prototype._updateQueueTaskWithStats = function(task, stats) {

@@ -227,21 +284,2 @@ if (stats.isFile()) {

Archiver.prototype._pipeModuleOutput = function() {
this._module.on('error', this._onModuleError.bind(this));
this._module.pipe(this);
this._state.modulePiped = true;
};
Archiver.prototype._processFile = function(source, data, callback) {
this.emit('error', new Error('method not implemented'));
};
Archiver.prototype._transform = function(chunk, encoding, callback) {
if (chunk) {
this._pointer += chunk.length;
}
callback(null, chunk);
};
Archiver.prototype.abort = function() {

@@ -319,9 +357,8 @@ if (this._state.aborted) {

var data = util._.extend({}, fileData);
var name = isExpandedPair ? file.dest : util.unixifyPath(file.dest || '', filepath);
data.name = isExpandedPair ? util.unixifyPath(file.dest) : util.unixifyPath(file.dest || '', filepath);
if (name === '.') {
if (data.name === '.') {
return;
}
data.name = name;
self._append(filepath, data);

@@ -382,3 +419,3 @@ });

this._module = module;
this._pipeModuleOutput();
this._modulePipe();
};

@@ -385,0 +422,0 @@

@@ -84,2 +84,10 @@ /**

}
};
Tar.prototype.unpipe = function() {
if (this.compressor) {
return this.compressor.unpipe.apply(this.compressor, arguments);
} else {
return this.engine.unpipe.apply(this.engine, arguments);
}
};

@@ -39,2 +39,6 @@ /**

return this.engine.pipe.apply(this.engine, arguments);
};
Zip.prototype.unpipe = function() {
return this.engine.unpipe.apply(this.engine, arguments);
};
{
"name": "archiver",
"version": "0.12.0",
"version": "0.13.0",
"description": "a streaming interface for archive generation",

@@ -38,11 +38,11 @@ "homepage": "https://github.com/ctalkington/node-archiver",

"buffer-crc32": "~0.2.1",
"glob": "~4.0.6",
"glob": "~4.2.0",
"lazystream": "~0.1.0",
"lodash": "~2.4.1",
"readable-stream": "~1.0.26",
"tar-stream": "~1.0.0",
"tar-stream": "~1.1.0",
"zip-stream": "~0.4.0"
},
"devDependencies": {
"chai": "~1.9.1",
"chai": "~1.10.0",
"mocha": "~2.0.1",

@@ -49,0 +49,0 @@ "rimraf": "~2.2.8",

@@ -1,2 +0,2 @@

# Archiver v0.12.0 [![Build Status](https://travis-ci.org/ctalkington/node-archiver.svg?branch=master)](https://travis-ci.org/ctalkington/node-archiver)
# Archiver v0.13.0 [![Build Status](https://travis-ci.org/ctalkington/node-archiver.svg?branch=master)](https://travis-ci.org/ctalkington/node-archiver)

@@ -31,4 +31,11 @@ a streaming interface for archive generation

Aborts the archiving process by clearing the remaining queue. The instance will remain available in a read-only state.
Aborts the archiving process, taking a best-effort approach, by:
* removing any pending queue tasks
* allowing any active queue workers to finish
* detaching internal module pipes
* ending both sides of the Transform stream
*It will NOT drain any remaining sources.*
#### append(input, data)

@@ -49,3 +56,3 @@

Appends multiple entries from passed array of src-dest mappings. A lazystream wrapper is used to prevent issues with open file limits.
Appends multiple entries from passed array of src-dest mappings. A [lazystream](https://github.com/jpommerening/node-lazystream) wrapper is used to prevent issues with open file limits.

@@ -67,3 +74,3 @@ Globbing patterns are supported through use of the [file-utils](https://github.com/SBoudrias/file-utils) package. Please note that multiple src files to single dest file (ie concat) is not supported.

Appends a file given its filepath using a lazystream wrapper to prevent issues with open file limits. When the instance has received, processed, and emitted the file, the `entry` event is fired.
Appends a file given its filepath using a [lazystream](https://github.com/jpommerening/node-lazystream) wrapper to prevent issues with open file limits. When the instance has received, processed, and emitted the file, the `entry` event is fired.

@@ -106,3 +113,3 @@ ```js

If true, all entry contents will be archived without compression by default.
If true, all entries will be archived without compression. Defaults to `false`.

@@ -127,3 +134,3 @@ #### zlib `object`

If true, entry contents will be archived without compression.
If true, this entry will be archived without compression. Defaults to global `store` option.

@@ -130,0 +137,0 @@ #### comment `string`

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