tar-iterator 2.1.0 → 2.2.0
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.
package/dist/cjs/TarIterator.js
CHANGED
|
@@ -11,7 +11,7 @@ Object.defineProperty(exports, "default", {
|
|
|
11
11
|
var _calloncefn = /*#__PURE__*/ _interop_require_default(require("call-once-fn"));
|
|
12
12
|
var _extractbaseiterator = /*#__PURE__*/ _interop_require_default(require("extract-base-iterator"));
|
|
13
13
|
var _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
|
|
14
|
-
var _tarstreamcompat = /*#__PURE__*/
|
|
14
|
+
var _tarstreamcompat = /*#__PURE__*/ _interop_require_wildcard(require("tar-stream-compat"));
|
|
15
15
|
var _Lockts = /*#__PURE__*/ _interop_require_default(require("./lib/Lock.js"));
|
|
16
16
|
var _nextEntryts = /*#__PURE__*/ _interop_require_default(require("./nextEntry.js"));
|
|
17
17
|
function _assert_this_initialized(self) {
|
|
@@ -53,6 +53,47 @@ function _interop_require_default(obj) {
|
|
|
53
53
|
default: obj
|
|
54
54
|
};
|
|
55
55
|
}
|
|
56
|
+
function _getRequireWildcardCache(nodeInterop) {
|
|
57
|
+
if (typeof WeakMap !== "function") return null;
|
|
58
|
+
var cacheBabelInterop = new WeakMap();
|
|
59
|
+
var cacheNodeInterop = new WeakMap();
|
|
60
|
+
return (_getRequireWildcardCache = function(nodeInterop) {
|
|
61
|
+
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
62
|
+
})(nodeInterop);
|
|
63
|
+
}
|
|
64
|
+
function _interop_require_wildcard(obj, nodeInterop) {
|
|
65
|
+
if (!nodeInterop && obj && obj.__esModule) {
|
|
66
|
+
return obj;
|
|
67
|
+
}
|
|
68
|
+
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
69
|
+
return {
|
|
70
|
+
default: obj
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
var cache = _getRequireWildcardCache(nodeInterop);
|
|
74
|
+
if (cache && cache.has(obj)) {
|
|
75
|
+
return cache.get(obj);
|
|
76
|
+
}
|
|
77
|
+
var newObj = {
|
|
78
|
+
__proto__: null
|
|
79
|
+
};
|
|
80
|
+
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
81
|
+
for(var key in obj){
|
|
82
|
+
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
83
|
+
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
84
|
+
if (desc && (desc.get || desc.set)) {
|
|
85
|
+
Object.defineProperty(newObj, key, desc);
|
|
86
|
+
} else {
|
|
87
|
+
newObj[key] = obj[key];
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
newObj.default = obj;
|
|
92
|
+
if (cache) {
|
|
93
|
+
cache.set(obj, newObj);
|
|
94
|
+
}
|
|
95
|
+
return newObj;
|
|
96
|
+
}
|
|
56
97
|
function _possible_constructor_return(self, call) {
|
|
57
98
|
if (call && (_type_of(call) === "object" || typeof call === "function")) {
|
|
58
99
|
return call;
|
|
@@ -95,7 +136,7 @@ var TarIterator = /*#__PURE__*/ function(BaseIterator) {
|
|
|
95
136
|
cancelled = true;
|
|
96
137
|
};
|
|
97
138
|
_this.processing.push(setup);
|
|
98
|
-
_this.extract = _tarstreamcompat.
|
|
139
|
+
_this.extract = _tarstreamcompat.extract();
|
|
99
140
|
var pipe = function(cb) {
|
|
100
141
|
try {
|
|
101
142
|
if (typeof source === 'string') source = _fs.default.createReadStream(source);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/tar-iterator/src/TarIterator.ts"],"sourcesContent":["import once from 'call-once-fn';\nimport BaseIterator from 'extract-base-iterator';\nimport fs from 'fs';\nimport tarStream from 'tar-stream-compat';\n\nimport Lock from './lib/Lock.ts';\nimport nextEntry from './nextEntry.ts';\n\nimport type { ExtractOptions } from './types.ts';\n\nexport default class TarIterator extends BaseIterator {\n lock: Lock;\n extract: NodeJS.WritableStream;\n\n constructor(source: string | NodeJS.ReadableStream, options: ExtractOptions = {}) {\n super(options);\n this.lock = new Lock();\n this.lock.iterator = this;\n\n let cancelled = false;\n const setup = (): undefined => {\n cancelled = true;\n };\n this.processing.push(setup);\n\n this.extract = tarStream.extract();\n const pipe = (cb) => {\n try {\n if (typeof source === 'string') source = fs.createReadStream(source);\n } catch (err) {\n cb(err);\n }\n\n const end = once(cb);\n (source as NodeJS.ReadableStream).on('data', () => end());\n (source as NodeJS.ReadableStream).on('error', end);\n (source as NodeJS.ReadableStream).pipe(this.extract);\n };\n pipe((err) => {\n this.processing.remove(setup);\n if (this.done || cancelled) return; // done\n err ? this.end(err) : this.push(nextEntry.bind(null, null));\n });\n }\n\n end(err?: Error) {\n if (this.lock) {\n this.lock.err = err;\n this.lock.release();\n this.lock = null;\n } else {\n BaseIterator.prototype.end.call(this, err); // call in lock release so end is properly handled\n }\n this.extract = null;\n }\n}\n"],"names":["TarIterator","source","options","lock","Lock","iterator","cancelled","setup","processing","push","extract","tarStream","pipe","cb","fs","createReadStream","err","end","once","on","remove","done","nextEntry","bind","release","BaseIterator","prototype","call"],"mappings":";;;;;;;eAUqBA;;;iEAVJ;0EACQ;yDACV;
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/tar-iterator/src/TarIterator.ts"],"sourcesContent":["import once from 'call-once-fn';\nimport BaseIterator from 'extract-base-iterator';\nimport fs from 'fs';\nimport * as tarStream from 'tar-stream-compat';\n\nimport Lock from './lib/Lock.ts';\nimport nextEntry from './nextEntry.ts';\n\nimport type { ExtractOptions } from './types.ts';\n\nexport default class TarIterator extends BaseIterator {\n lock: Lock;\n extract: NodeJS.WritableStream;\n\n constructor(source: string | NodeJS.ReadableStream, options: ExtractOptions = {}) {\n super(options);\n this.lock = new Lock();\n this.lock.iterator = this;\n\n let cancelled = false;\n const setup = (): undefined => {\n cancelled = true;\n };\n this.processing.push(setup);\n\n this.extract = tarStream.extract();\n const pipe = (cb) => {\n try {\n if (typeof source === 'string') source = fs.createReadStream(source);\n } catch (err) {\n cb(err);\n }\n\n const end = once(cb);\n (source as NodeJS.ReadableStream).on('data', () => end());\n (source as NodeJS.ReadableStream).on('error', end);\n (source as NodeJS.ReadableStream).pipe(this.extract);\n };\n pipe((err) => {\n this.processing.remove(setup);\n if (this.done || cancelled) return; // done\n err ? this.end(err) : this.push(nextEntry.bind(null, null));\n });\n }\n\n end(err?: Error) {\n if (this.lock) {\n this.lock.err = err;\n this.lock.release();\n this.lock = null;\n } else {\n BaseIterator.prototype.end.call(this, err); // call in lock release so end is properly handled\n }\n this.extract = null;\n }\n}\n"],"names":["TarIterator","source","options","lock","Lock","iterator","cancelled","setup","processing","push","extract","tarStream","pipe","cb","fs","createReadStream","err","end","once","on","remove","done","nextEntry","bind","release","BaseIterator","prototype","call"],"mappings":";;;;;;;eAUqBA;;;iEAVJ;0EACQ;yDACV;uEACY;6DAEV;kEACK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIP,IAAA,AAAMA,4BAAN;;cAAMA;aAAAA,YAIPC,MAAsC;YAAEC,UAAAA,iEAA0B,CAAC;gCAJ5DF;;gBAKjB,kBALiBA;YAKXE;;QACN,MAAKC,IAAI,GAAG,IAAIC,eAAI;QACpB,MAAKD,IAAI,CAACE,QAAQ;QAElB,IAAIC,YAAY;QAChB,IAAMC,QAAQ;YACZD,YAAY;QACd;QACA,MAAKE,UAAU,CAACC,IAAI,CAACF;QAErB,MAAKG,OAAO,GAAGC,iBAAUD,OAAO;QAChC,IAAME,OAAO,SAACC;YACZ,IAAI;gBACF,IAAI,OAAOZ,WAAW,UAAUA,SAASa,WAAE,CAACC,gBAAgB,CAACd;YAC/D,EAAE,OAAOe,KAAK;gBACZH,GAAGG;YACL;YAEA,IAAMC,MAAMC,IAAAA,mBAAI,EAACL;YAChBZ,OAAiCkB,EAAE,CAAC,QAAQ;uBAAMF;;YAClDhB,OAAiCkB,EAAE,CAAC,SAASF;YAC7ChB,OAAiCW,IAAI,CAAC,MAAKF,OAAO;QACrD;QACAE,KAAK,SAACI;YACJ,MAAKR,UAAU,CAACY,MAAM,CAACb;YACvB,IAAI,MAAKc,IAAI,IAAIf,WAAW,QAAQ,OAAO;YAC3CU,MAAM,MAAKC,GAAG,CAACD,OAAO,MAAKP,IAAI,CAACa,oBAAS,CAACC,IAAI,CAAC,MAAM;QACvD;;;iBAhCiBvB;IAmCnBiB,OAAAA,GASC,GATDA,SAAAA,IAAID,GAAW;QACb,IAAI,IAAI,CAACb,IAAI,EAAE;YACb,IAAI,CAACA,IAAI,CAACa,GAAG,GAAGA;YAChB,IAAI,CAACb,IAAI,CAACqB,OAAO;YACjB,IAAI,CAACrB,IAAI,GAAG;QACd,OAAO;YACLsB,4BAAY,CAACC,SAAS,CAACT,GAAG,CAACU,IAAI,CAAC,IAAI,EAAEX,MAAM,kDAAkD;QAChG;QACA,IAAI,CAACN,OAAO,GAAG;IACjB;WA5CmBV;EAAoByB,4BAAY"}
|
package/dist/esm/TarIterator.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import once from 'call-once-fn';
|
|
2
2
|
import BaseIterator from 'extract-base-iterator';
|
|
3
3
|
import fs from 'fs';
|
|
4
|
-
import tarStream from 'tar-stream-compat';
|
|
4
|
+
import * as tarStream from 'tar-stream-compat';
|
|
5
5
|
import Lock from './lib/Lock.js';
|
|
6
6
|
import nextEntry from './nextEntry.js';
|
|
7
7
|
let TarIterator = class TarIterator extends BaseIterator {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/tar-iterator/src/TarIterator.ts"],"sourcesContent":["import once from 'call-once-fn';\nimport BaseIterator from 'extract-base-iterator';\nimport fs from 'fs';\nimport tarStream from 'tar-stream-compat';\n\nimport Lock from './lib/Lock.ts';\nimport nextEntry from './nextEntry.ts';\n\nimport type { ExtractOptions } from './types.ts';\n\nexport default class TarIterator extends BaseIterator {\n lock: Lock;\n extract: NodeJS.WritableStream;\n\n constructor(source: string | NodeJS.ReadableStream, options: ExtractOptions = {}) {\n super(options);\n this.lock = new Lock();\n this.lock.iterator = this;\n\n let cancelled = false;\n const setup = (): undefined => {\n cancelled = true;\n };\n this.processing.push(setup);\n\n this.extract = tarStream.extract();\n const pipe = (cb) => {\n try {\n if (typeof source === 'string') source = fs.createReadStream(source);\n } catch (err) {\n cb(err);\n }\n\n const end = once(cb);\n (source as NodeJS.ReadableStream).on('data', () => end());\n (source as NodeJS.ReadableStream).on('error', end);\n (source as NodeJS.ReadableStream).pipe(this.extract);\n };\n pipe((err) => {\n this.processing.remove(setup);\n if (this.done || cancelled) return; // done\n err ? this.end(err) : this.push(nextEntry.bind(null, null));\n });\n }\n\n end(err?: Error) {\n if (this.lock) {\n this.lock.err = err;\n this.lock.release();\n this.lock = null;\n } else {\n BaseIterator.prototype.end.call(this, err); // call in lock release so end is properly handled\n }\n this.extract = null;\n }\n}\n"],"names":["once","BaseIterator","fs","tarStream","Lock","nextEntry","TarIterator","end","err","lock","release","prototype","call","extract","source","options","iterator","cancelled","setup","processing","push","pipe","cb","createReadStream","on","remove","done","bind"],"mappings":"AAAA,OAAOA,UAAU,eAAe;AAChC,OAAOC,kBAAkB,wBAAwB;AACjD,OAAOC,QAAQ,KAAK;AACpB,
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/tar-iterator/src/TarIterator.ts"],"sourcesContent":["import once from 'call-once-fn';\nimport BaseIterator from 'extract-base-iterator';\nimport fs from 'fs';\nimport * as tarStream from 'tar-stream-compat';\n\nimport Lock from './lib/Lock.ts';\nimport nextEntry from './nextEntry.ts';\n\nimport type { ExtractOptions } from './types.ts';\n\nexport default class TarIterator extends BaseIterator {\n lock: Lock;\n extract: NodeJS.WritableStream;\n\n constructor(source: string | NodeJS.ReadableStream, options: ExtractOptions = {}) {\n super(options);\n this.lock = new Lock();\n this.lock.iterator = this;\n\n let cancelled = false;\n const setup = (): undefined => {\n cancelled = true;\n };\n this.processing.push(setup);\n\n this.extract = tarStream.extract();\n const pipe = (cb) => {\n try {\n if (typeof source === 'string') source = fs.createReadStream(source);\n } catch (err) {\n cb(err);\n }\n\n const end = once(cb);\n (source as NodeJS.ReadableStream).on('data', () => end());\n (source as NodeJS.ReadableStream).on('error', end);\n (source as NodeJS.ReadableStream).pipe(this.extract);\n };\n pipe((err) => {\n this.processing.remove(setup);\n if (this.done || cancelled) return; // done\n err ? this.end(err) : this.push(nextEntry.bind(null, null));\n });\n }\n\n end(err?: Error) {\n if (this.lock) {\n this.lock.err = err;\n this.lock.release();\n this.lock = null;\n } else {\n BaseIterator.prototype.end.call(this, err); // call in lock release so end is properly handled\n }\n this.extract = null;\n }\n}\n"],"names":["once","BaseIterator","fs","tarStream","Lock","nextEntry","TarIterator","end","err","lock","release","prototype","call","extract","source","options","iterator","cancelled","setup","processing","push","pipe","cb","createReadStream","on","remove","done","bind"],"mappings":"AAAA,OAAOA,UAAU,eAAe;AAChC,OAAOC,kBAAkB,wBAAwB;AACjD,OAAOC,QAAQ,KAAK;AACpB,YAAYC,eAAe,oBAAoB;AAE/C,OAAOC,UAAU,gBAAgB;AACjC,OAAOC,eAAe,iBAAiB;AAIxB,IAAA,AAAMC,cAAN,MAAMA,oBAAoBL;IAmCvCM,IAAIC,GAAW,EAAE;QACf,IAAI,IAAI,CAACC,IAAI,EAAE;YACb,IAAI,CAACA,IAAI,CAACD,GAAG,GAAGA;YAChB,IAAI,CAACC,IAAI,CAACC,OAAO;YACjB,IAAI,CAACD,IAAI,GAAG;QACd,OAAO;YACLR,aAAaU,SAAS,CAACJ,GAAG,CAACK,IAAI,CAAC,IAAI,EAAEJ,MAAM,kDAAkD;QAChG;QACA,IAAI,CAACK,OAAO,GAAG;IACjB;IAxCA,YAAYC,MAAsC,EAAEC,UAA0B,CAAC,CAAC,CAAE;QAChF,KAAK,CAACA;QACN,IAAI,CAACN,IAAI,GAAG,IAAIL;QAChB,IAAI,CAACK,IAAI,CAACO,QAAQ,GAAG,IAAI;QAEzB,IAAIC,YAAY;QAChB,MAAMC,QAAQ;YACZD,YAAY;QACd;QACA,IAAI,CAACE,UAAU,CAACC,IAAI,CAACF;QAErB,IAAI,CAACL,OAAO,GAAGV,UAAUU,OAAO;QAChC,MAAMQ,OAAO,CAACC;YACZ,IAAI;gBACF,IAAI,OAAOR,WAAW,UAAUA,SAASZ,GAAGqB,gBAAgB,CAACT;YAC/D,EAAE,OAAON,KAAK;gBACZc,GAAGd;YACL;YAEA,MAAMD,MAAMP,KAAKsB;YAChBR,OAAiCU,EAAE,CAAC,QAAQ,IAAMjB;YAClDO,OAAiCU,EAAE,CAAC,SAASjB;YAC7CO,OAAiCO,IAAI,CAAC,IAAI,CAACR,OAAO;QACrD;QACAQ,KAAK,CAACb;YACJ,IAAI,CAACW,UAAU,CAACM,MAAM,CAACP;YACvB,IAAI,IAAI,CAACQ,IAAI,IAAIT,WAAW,QAAQ,OAAO;YAC3CT,MAAM,IAAI,CAACD,GAAG,CAACC,OAAO,IAAI,CAACY,IAAI,CAACf,UAAUsB,IAAI,CAAC,MAAM;QACvD;IACF;AAYF;AA7CA,SAAqBrB,yBA6CpB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tar-iterator",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"description": "Extract contents from tar archive type using an iterator API using streams or paths. Use stream interface and pipe transforms to add decompression algorithms",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"extract",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"mkdirp-classic": "^0.5.3",
|
|
66
66
|
"on-one": "^0.1.9",
|
|
67
67
|
"rimraf2": "^2.8.2",
|
|
68
|
-
"tar-stream-compat": "2.
|
|
68
|
+
"tar-stream-compat": "^2.3.0"
|
|
69
69
|
},
|
|
70
70
|
"devDependencies": {
|
|
71
71
|
"@types/mocha": "*",
|