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.13.0 to 0.13.1

lib/core.js

47

lib/archiver.js

@@ -8,4 +8,4 @@ /**

*/
var ArchiverCore = require('./modules/core');
var formatModules = {};
var ArchiverCore = require('./core');
var formats = {};

@@ -17,9 +17,10 @@ var archiver = module.exports = function(format, options) {

archiver.create = function(format, options) {
if (formatModules[format]) {
var inst = new ArchiverCore(options);
inst.setModule(new formatModules[format](options));
if (formats[format]) {
var instance = new ArchiverCore(options);
instance.setFormat(format);
instance.setModule(new formats[format](options));
return inst;
return instance;
} else {
throw new Error('unknown format: ' + format);
throw new Error('create(' + format + '): format not registered');
}

@@ -29,17 +30,25 @@ };

archiver.registerFormat = function(format, module) {
if (module && typeof module === 'function' && typeof module.prototype.append === 'function') {
formatModules[format] = module;
if (formats[format]) {
throw new Error('register(' + format + '): format already registered');
}
// backwards compat
var compatName = 'create' + format.charAt(0).toUpperCase() + format.slice(1);
archiver[compatName] = function(options) {
return archiver.create(format, options);
};
} else {
throw new Error('format module invalid: ' + format);
if (typeof module !== 'function') {
throw new Error('register(' + format + '): format module invalid');
}
if (typeof module.prototype.append !== 'function' || typeof module.prototype.finalize !== 'function') {
throw new Error('register(' + format + '): format module missing methods');
}
formats[format] = module;
// backwards compat - to be removed in 0.14
var compatName = 'create' + format.charAt(0).toUpperCase() + format.slice(1);
archiver[compatName] = function(options) {
return archiver.create(format, options);
};
};
archiver.registerFormat('zip', require('./modules/zip'));
archiver.registerFormat('tar', require('./modules/tar'));
archiver.registerFormat('json', require('./modules/json'));
archiver.registerFormat('zip', require('./plugins/zip'));
archiver.registerFormat('tar', require('./plugins/tar'));
archiver.registerFormat('json', require('./plugins/json'));
{
"name": "archiver",
"version": "0.13.0",
"version": "0.13.1",
"description": "a streaming interface for archive generation",

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

"buffer-crc32": "~0.2.1",
"glob": "~4.2.0",
"glob": "~4.3.0",
"lazystream": "~0.1.0",

@@ -44,10 +44,12 @@ "lodash": "~2.4.1",

"tar-stream": "~1.1.0",
"zip-stream": "~0.4.0"
"zip-stream": "~0.5.0"
},
"devDependencies": {
"chai": "~1.10.0",
"mocha": "~2.0.1",
"mocha": "~2.1.0",
"rimraf": "~2.2.8",
"mkdirp": "~0.5.0",
"stream-bench": "~0.1.2"
"stream-bench": "~0.1.2",
"tar": "~1.0.3",
"unzip2": "~0.2.0"
},

@@ -54,0 +56,0 @@ "keywords": [

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

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

@@ -57,3 +57,3 @@ a streaming interface for archive generation

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.
Globbing patterns are supported through use of the bundled [file-utils](https://github.com/SBoudrias/file-utils) module.

@@ -95,3 +95,3 @@ The `data` property can be set (per src-dest mapping) to define data for matched entries.

Fired when the input has been received, processed, and emitted. Passes entry data as first argument.
Fired when the entry's input has been processed and appended to the archive. Passes entry data as first argument.

@@ -186,2 +186,6 @@ ## Zip

## Custom Formats
Archiver ships with out of the box support for TAR and ZIP archives. You can register additional formats with `registerFormat`.
## Libraries

@@ -188,0 +192,0 @@

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