Comparing version 0.13.0 to 0.13.1
@@ -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 @@ |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
35092
811
201
7
1
+ Addedbalanced-match@1.0.2(transitive)
+ Addedbrace-expansion@1.1.11(transitive)
+ Addedcompress-commons@0.2.9(transitive)
+ Addedconcat-map@0.0.1(transitive)
+ Addedglob@4.3.5(transitive)
+ Addedlodash@3.2.0(transitive)
+ Addedminimatch@2.0.10(transitive)
+ Addednode-int64@0.3.3(transitive)
+ Addedzip-stream@0.5.2(transitive)
- Removedcompress-commons@0.1.6(transitive)
- Removedglob@4.2.2(transitive)
- Removedlru-cache@2.7.3(transitive)
- Removedminimatch@1.0.0(transitive)
- Removedsigmund@1.0.1(transitive)
- Removedzip-stream@0.4.1(transitive)
Updatedglob@~4.3.0
Updatedzip-stream@~0.5.0