aboutsummaryrefslogtreecommitdiff
path: root/node_modules/archiver/lib/plugins/json.js
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2019-03-27 21:01:33 +0100
committerFlorian Dold <florian.dold@gmail.com>2019-03-27 21:01:33 +0100
commitcc97a4dd2a967e1c2273bd5f4c5f49a5bf2e2585 (patch)
tree92c5d88706a6ffc654d1b133618d357890e7096b /node_modules/archiver/lib/plugins/json.js
parent3771b4d6b67b34c130f3a9a1a15f42deefdb2eda (diff)
remove node_modules
Diffstat (limited to 'node_modules/archiver/lib/plugins/json.js')
-rw-r--r--node_modules/archiver/lib/plugins/json.js109
1 files changed, 0 insertions, 109 deletions
diff --git a/node_modules/archiver/lib/plugins/json.js b/node_modules/archiver/lib/plugins/json.js
deleted file mode 100644
index 3af112c13..000000000
--- a/node_modules/archiver/lib/plugins/json.js
+++ /dev/null
@@ -1,109 +0,0 @@
-/**
- * JSON Format Plugin
- *
- * @module plugins/json
- * @license [MIT]{@link https://github.com/archiverjs/node-archiver/blob/master/LICENSE}
- * @copyright (c) 2012-2014 Chris Talkington, contributors.
- */
-var inherits = require('util').inherits;
-var Transform = require('readable-stream').Transform;
-
-var crc32 = require('buffer-crc32');
-var util = require('archiver-utils');
-
-/**
- * @constructor
- * @param {(JsonOptions|TransformOptions)} options
- */
-var Json = function(options) {
- if (!(this instanceof Json)) {
- return new Json(options);
- }
-
- options = this.options = util.defaults(options, {});
-
- Transform.call(this, options);
-
- this.supports = {
- directory: true
- };
-
- this.files = [];
-};
-
-inherits(Json, Transform);
-
-/**
- * [_transform description]
- *
- * @private
- * @param {Buffer} chunk
- * @param {String} encoding
- * @param {Function} callback
- * @return void
- */
-Json.prototype._transform = function(chunk, encoding, callback) {
- callback(null, chunk);
-};
-
-/**
- * [_writeStringified description]
- *
- * @private
- * @return void
- */
-Json.prototype._writeStringified = function() {
- var fileString = JSON.stringify(this.files);
- this.write(fileString);
-};
-
-/**
- * [append description]
- *
- * @param {(Buffer|Stream)} source
- * @param {EntryData} data
- * @param {Function} callback
- * @return void
- */
-Json.prototype.append = function(source, data, callback) {
- var self = this;
-
- data.crc32 = 0;
-
- function onend(err, sourceBuffer) {
- if (err) {
- callback(err);
- return;
- }
-
- data.size = sourceBuffer.length || 0;
- data.crc32 = crc32.unsigned(sourceBuffer);
-
- self.files.push(data);
-
- callback(null, data);
- }
-
- if (data.sourceType === 'buffer') {
- onend(null, source);
- } else if (data.sourceType === 'stream') {
- util.collectStream(source, onend);
- }
-};
-
-/**
- * [finalize description]
- *
- * @return void
- */
-Json.prototype.finalize = function() {
- this._writeStringified();
- this.end();
-};
-
-module.exports = Json;
-
-/**
- * @typedef {Object} JsonOptions
- * @global
- */ \ No newline at end of file