aboutsummaryrefslogtreecommitdiff
path: root/node_modules/archiver/index.js
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2016-10-10 03:43:44 +0200
committerFlorian Dold <florian.dold@gmail.com>2016-10-10 03:43:44 +0200
commitabd94a7f5a50f43c797a11b53549ae48fff667c3 (patch)
treeab8ed457f65cdd72e13e0571d2975729428f1551 /node_modules/archiver/index.js
parenta0247c6a3fd6a09a41a7e35a3441324c4dcb58be (diff)
downloadwallet-core-abd94a7f5a50f43c797a11b53549ae48fff667c3.tar.xz
add node_modules to address #4364
Diffstat (limited to 'node_modules/archiver/index.js')
-rw-r--r--node_modules/archiver/index.js70
1 files changed, 70 insertions, 0 deletions
diff --git a/node_modules/archiver/index.js b/node_modules/archiver/index.js
new file mode 100644
index 000000000..bcaebf1fd
--- /dev/null
+++ b/node_modules/archiver/index.js
@@ -0,0 +1,70 @@
+/**
+ * Archiver Vending
+ *
+ * @ignore
+ * @license [MIT]{@link https://github.com/archiverjs/node-archiver/blob/master/LICENSE}
+ * @copyright (c) 2012-2014 Chris Talkington, contributors.
+ */
+var Archiver = require('./lib/core');
+
+var formats = {};
+
+/**
+ * Dispenses a new Archiver instance.
+ *
+ * @constructor
+ * @param {String} format The archive format to use.
+ * @param {Object} options See [Archiver]{@link Archiver}
+ * @return {Archiver}
+ */
+var vending = function(format, options) {
+ return vending.create(format, options);
+};
+
+/**
+ * Creates a new Archiver instance.
+ *
+ * @param {String} format The archive format to use.
+ * @param {Object} options See [Archiver]{@link Archiver}
+ * @return {Archiver}
+ */
+vending.create = function(format, options) {
+ if (formats[format]) {
+ var instance = new Archiver(format, options);
+ instance.setFormat(format);
+ instance.setModule(new formats[format](options));
+
+ return instance;
+ } else {
+ throw new Error('create(' + format + '): format not registered');
+ }
+};
+
+/**
+ * Registers a format for use with archiver.
+ *
+ * @param {String} format The name of the format.
+ * @param {Function} module The function for archiver to interact with.
+ * @return void
+ */
+vending.registerFormat = function(format, module) {
+ if (formats[format]) {
+ throw new Error('register(' + format + '): format already registered');
+ }
+
+ 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;
+};
+
+vending.registerFormat('zip', require('./lib/plugins/zip'));
+vending.registerFormat('tar', require('./lib/plugins/tar'));
+vending.registerFormat('json', require('./lib/plugins/json'));
+
+module.exports = vending; \ No newline at end of file