archiver-node 8.0.2 → 8.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,110 +1,114 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- // If the importer is in node compatibility mode or this is not an ESM
21
- // file that has been converted to a CommonJS file using a Babel-
22
- // compatible transform (i.e. "__esModule" has not been set), then set
23
- // "default" to the CommonJS "module.exports" for node compatibility.
24
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
- mod
26
- ));
27
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
- var json_exports = {};
29
- __export(json_exports, {
30
- default: () => Json
1
+ "use strict";
2
+
3
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
31
6
  });
32
- module.exports = __toCommonJS(json_exports);
33
- var import_readable_stream = require("readable-stream");
34
- var import_buffer_crc32 = __toESM(require("buffer-crc32"), 1);
35
- var import_utils = require("../utils.js");
36
- /**
37
- * JSON Format Plugin
38
- *
39
- * @module plugins/json
40
- * @license [MIT]{@link https://github.com/archiverjs/node-archiver/blob/master/LICENSE}
41
- * @copyright (c) 2012-2014 Chris Talkington, contributors.
7
+ exports["default"] = void 0;
8
+ var _readableStream = require("readable-stream");
9
+ var _bufferCrc = _interopRequireDefault(require("buffer-crc32"));
10
+ var _utils = require("../utils.js");
11
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
12
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
13
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
14
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
15
+ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
16
+ function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
17
+ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
18
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
19
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
20
+ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
21
+ function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
22
+ function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
23
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
24
+ function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
25
+ function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
26
+ function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
27
+ /**
28
+ * JSON Format Plugin
29
+ *
30
+ * @module plugins/json
31
+ * @license [MIT]{@link https://github.com/archiverjs/node-archiver/blob/master/LICENSE}
32
+ * @copyright (c) 2012-2014 Chris Talkington, contributors.
42
33
  */
43
- class Json extends import_readable_stream.Transform {
44
- /**
45
- * @constructor
46
- * @param {(JsonOptions|TransformOptions)} options
47
- */
48
- constructor(options) {
49
- super({ ...options });
50
- this.files = [];
51
- }
52
- /**
53
- * [_transform description]
54
- *
55
- * @private
56
- * @param {Buffer} chunk
57
- * @param {String} encoding
58
- * @param {Function} callback
59
- * @return void
34
+ var Json = exports["default"] = /*#__PURE__*/function (_Transform) {
35
+ /**
36
+ * @constructor
37
+ * @param {(JsonOptions|TransformOptions)} options
60
38
  */
61
- _transform(chunk, encoding, callback) {
62
- callback(null, chunk);
39
+ function Json(options) {
40
+ var _this;
41
+ _classCallCheck(this, Json);
42
+ _this = _callSuper(this, Json, [_objectSpread({}, options)]);
43
+ _this.files = [];
44
+ return _this;
63
45
  }
64
- /**
65
- * [_writeStringified description]
66
- *
67
- * @private
68
- * @return void
46
+ /**
47
+ * [_transform description]
48
+ *
49
+ * @private
50
+ * @param {Buffer} chunk
51
+ * @param {String} encoding
52
+ * @param {Function} callback
53
+ * @return void
69
54
  */
70
- _writeStringified() {
71
- var fileString = JSON.stringify(this.files);
72
- this.write(fileString);
73
- }
74
- /**
75
- * [append description]
76
- *
77
- * @param {(Buffer|Stream)} source
78
- * @param {EntryData} data
79
- * @param {Function} callback
80
- * @return void
81
- */
82
- append(source, data, callback) {
83
- var self = this;
84
- data.crc32 = 0;
85
- function onend(err, sourceBuffer) {
86
- if (err) {
87
- callback(err);
88
- return;
55
+ _inherits(Json, _Transform);
56
+ return _createClass(Json, [{
57
+ key: "_transform",
58
+ value: function _transform(chunk, encoding, callback) {
59
+ callback(null, chunk);
60
+ }
61
+ /**
62
+ * [_writeStringified description]
63
+ *
64
+ * @private
65
+ * @return void
66
+ */
67
+ }, {
68
+ key: "_writeStringified",
69
+ value: function _writeStringified() {
70
+ var fileString = JSON.stringify(this.files);
71
+ this.write(fileString);
72
+ }
73
+ /**
74
+ * [append description]
75
+ *
76
+ * @param {(Buffer|Stream)} source
77
+ * @param {EntryData} data
78
+ * @param {Function} callback
79
+ * @return void
80
+ */
81
+ }, {
82
+ key: "append",
83
+ value: function append(source, data, callback) {
84
+ var self = this;
85
+ data.crc32 = 0;
86
+ function onend(err, sourceBuffer) {
87
+ if (err) {
88
+ callback(err);
89
+ return;
90
+ }
91
+ data.size = sourceBuffer.length || 0;
92
+ data.crc32 = _bufferCrc["default"].unsigned(sourceBuffer);
93
+ self.files.push(data);
94
+ callback(null, data);
95
+ }
96
+ if (data.sourceType === "buffer") {
97
+ onend(null, source);
98
+ } else if (data.sourceType === "stream") {
99
+ (0, _utils.collectStream)(source, onend);
89
100
  }
90
- data.size = sourceBuffer.length || 0;
91
- data.crc32 = import_buffer_crc32.default.unsigned(sourceBuffer);
92
- self.files.push(data);
93
- callback(null, data);
94
101
  }
95
- if (data.sourceType === "buffer") {
96
- onend(null, source);
97
- } else if (data.sourceType === "stream") {
98
- (0, import_utils.collectStream)(source, onend);
102
+ /**
103
+ * [finalize description]
104
+ *
105
+ * @return void
106
+ */
107
+ }, {
108
+ key: "finalize",
109
+ value: function finalize() {
110
+ this._writeStringified();
111
+ this.end();
99
112
  }
100
- }
101
- /**
102
- * [finalize description]
103
- *
104
- * @return void
105
- */
106
- finalize() {
107
- this._writeStringified();
108
- this.end();
109
- }
110
- }
113
+ }]);
114
+ }(_readableStream.Transform);
@@ -1,147 +1,144 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- // If the importer is in node compatibility mode or this is not an ESM
21
- // file that has been converted to a CommonJS file using a Babel-
22
- // compatible transform (i.e. "__esModule" has not been set), then set
23
- // "default" to the CommonJS "module.exports" for node compatibility.
24
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
- mod
26
- ));
27
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
- var tar_exports = {};
29
- __export(tar_exports, {
30
- default: () => Tar
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
31
5
  });
32
- module.exports = __toCommonJS(tar_exports);
33
- var import_zlib = __toESM(require("zlib"), 1);
34
- var import_tar_stream = __toESM(require("tar-stream"), 1);
35
- var import_utils = require("../utils.js");
36
- /**
37
- * TAR Format Plugin
38
- *
39
- * @module plugins/tar
40
- * @license [MIT]{@link https://github.com/archiverjs/node-archiver/blob/master/LICENSE}
41
- * @copyright (c) 2012-2014 Chris Talkington, contributors.
6
+ exports["default"] = void 0;
7
+ var _zlib = _interopRequireDefault(require("zlib"));
8
+ var _tarStream = _interopRequireDefault(require("tar-stream"));
9
+ var _utils = require("../utils.js");
10
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
11
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
12
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
13
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
14
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
15
+ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
16
+ function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
17
+ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
18
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
19
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
20
+ /**
21
+ * TAR Format Plugin
22
+ *
23
+ * @module plugins/tar
24
+ * @license [MIT]{@link https://github.com/archiverjs/node-archiver/blob/master/LICENSE}
25
+ * @copyright (c) 2012-2014 Chris Talkington, contributors.
42
26
  */
43
- class Tar {
44
- /**
45
- * @constructor
46
- * @param {TarOptions} options
27
+ var Tar = exports["default"] = /*#__PURE__*/function () {
28
+ /**
29
+ * @constructor
30
+ * @param {TarOptions} options
47
31
  */
48
- constructor(options) {
49
- options = this.options = {
50
- gzip: false,
51
- ...options
52
- };
53
- if (typeof options.gzipOptions !== "object") {
32
+ function Tar(options) {
33
+ _classCallCheck(this, Tar);
34
+ options = this.options = _objectSpread({
35
+ gzip: false
36
+ }, options);
37
+ if (_typeof(options.gzipOptions) !== "object") {
54
38
  options.gzipOptions = {};
55
39
  }
56
- this.engine = import_tar_stream.default.pack(options);
40
+ this.engine = _tarStream["default"].pack(options);
57
41
  this.compressor = false;
58
42
  if (options.gzip) {
59
- this.compressor = import_zlib.default.createGzip(options.gzipOptions);
43
+ this.compressor = _zlib["default"].createGzip(options.gzipOptions);
60
44
  this.compressor.on("error", this._onCompressorError.bind(this));
61
45
  }
62
46
  }
63
- /**
64
- * [_onCompressorError description]
65
- *
66
- * @private
67
- * @param {Error} err
68
- * @return void
69
- */
70
- _onCompressorError(err) {
71
- this.engine.emit("error", err);
72
- }
73
- /**
74
- * [append description]
75
- *
76
- * @param {(Buffer|Stream)} source
77
- * @param {TarEntryData} data
78
- * @param {Function} callback
79
- * @return void
47
+ /**
48
+ * [_onCompressorError description]
49
+ *
50
+ * @private
51
+ * @param {Error} err
52
+ * @return void
80
53
  */
81
- append(source, data, callback) {
82
- var self = this;
83
- data.mtime = data.date;
84
- function append(err, sourceBuffer) {
85
- if (err) {
86
- callback(err);
87
- return;
54
+ return _createClass(Tar, [{
55
+ key: "_onCompressorError",
56
+ value: function _onCompressorError(err) {
57
+ this.engine.emit("error", err);
58
+ }
59
+ /**
60
+ * [append description]
61
+ *
62
+ * @param {(Buffer|Stream)} source
63
+ * @param {TarEntryData} data
64
+ * @param {Function} callback
65
+ * @return void
66
+ */
67
+ }, {
68
+ key: "append",
69
+ value: function append(source, data, callback) {
70
+ var self = this;
71
+ data.mtime = data.date;
72
+ function append(err, sourceBuffer) {
73
+ if (err) {
74
+ callback(err);
75
+ return;
76
+ }
77
+ self.engine.entry(data, sourceBuffer, function (err) {
78
+ callback(err, data);
79
+ });
80
+ }
81
+ if (data.sourceType === "buffer") {
82
+ append(null, source);
83
+ } else if (data.sourceType === "stream" && data.stats) {
84
+ data.size = data.stats.size;
85
+ var entry = self.engine.entry(data, function (err) {
86
+ callback(err, data);
87
+ });
88
+ source.pipe(entry);
89
+ } else if (data.sourceType === "stream") {
90
+ (0, _utils.collectStream)(source, append);
88
91
  }
89
- self.engine.entry(data, sourceBuffer, function(err2) {
90
- callback(err2, data);
91
- });
92
92
  }
93
- if (data.sourceType === "buffer") {
94
- append(null, source);
95
- } else if (data.sourceType === "stream" && data.stats) {
96
- data.size = data.stats.size;
97
- var entry = self.engine.entry(data, function(err) {
98
- callback(err, data);
99
- });
100
- source.pipe(entry);
101
- } else if (data.sourceType === "stream") {
102
- (0, import_utils.collectStream)(source, append);
93
+ /**
94
+ * [finalize description]
95
+ *
96
+ * @return void
97
+ */
98
+ }, {
99
+ key: "finalize",
100
+ value: function finalize() {
101
+ this.engine.finalize();
103
102
  }
104
- }
105
- /**
106
- * [finalize description]
107
- *
108
- * @return void
109
- */
110
- finalize() {
111
- this.engine.finalize();
112
- }
113
- /**
114
- * [on description]
115
- *
116
- * @return this.engine
117
- */
118
- on() {
119
- return this.engine.on.apply(this.engine, arguments);
120
- }
121
- /**
122
- * [pipe description]
123
- *
124
- * @param {String} destination
125
- * @param {Object} options
126
- * @return this.engine
127
- */
128
- pipe(destination, options) {
129
- if (this.compressor) {
130
- return this.engine.pipe.apply(this.engine, [this.compressor]).pipe(destination, options);
131
- } else {
132
- return this.engine.pipe.apply(this.engine, arguments);
103
+ /**
104
+ * [on description]
105
+ *
106
+ * @return this.engine
107
+ */
108
+ }, {
109
+ key: "on",
110
+ value: function on() {
111
+ return this.engine.on.apply(this.engine, arguments);
133
112
  }
134
- }
135
- /**
136
- * [unpipe description]
137
- *
138
- * @return this.engine
139
- */
140
- unpipe() {
141
- if (this.compressor) {
142
- return this.compressor.unpipe.apply(this.compressor, arguments);
143
- } else {
144
- return this.engine.unpipe.apply(this.engine, arguments);
113
+ /**
114
+ * [pipe description]
115
+ *
116
+ * @param {String} destination
117
+ * @param {Object} options
118
+ * @return this.engine
119
+ */
120
+ }, {
121
+ key: "pipe",
122
+ value: function pipe(destination, options) {
123
+ if (this.compressor) {
124
+ return this.engine.pipe.apply(this.engine, [this.compressor]).pipe(destination, options);
125
+ } else {
126
+ return this.engine.pipe.apply(this.engine, arguments);
127
+ }
145
128
  }
146
- }
147
- }
129
+ /**
130
+ * [unpipe description]
131
+ *
132
+ * @return this.engine
133
+ */
134
+ }, {
135
+ key: "unpipe",
136
+ value: function unpipe() {
137
+ if (this.compressor) {
138
+ return this.compressor.unpipe.apply(this.compressor, arguments);
139
+ } else {
140
+ return this.engine.unpipe.apply(this.engine, arguments);
141
+ }
142
+ }
143
+ }]);
144
+ }();