tar-iterator 3.3.5 → 3.3.7

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.
@@ -96,13 +96,14 @@ var TarFileEntry = /*#__PURE__*/ function(FileEntry) {
96
96
  callback = typeof options === 'function' ? options : callback;
97
97
  options = typeof options === 'function' ? {} : options || {};
98
98
  if (typeof callback === 'function') {
99
- return _extractbaseiterator.FileEntry.prototype.create.call(this, dest, options, function(err) {
99
+ _extractbaseiterator.FileEntry.prototype.create.call(this, dest, options, function(err) {
100
100
  callback(err);
101
101
  if (_this.lock) {
102
102
  _this.lock.release();
103
103
  _this.lock = null;
104
104
  }
105
105
  });
106
+ return;
106
107
  }
107
108
  return new Promise(function(resolve, reject) {
108
109
  return _this.create(dest, options, function(err, done) {
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/tar-iterator/src/FileEntry.ts"],"sourcesContent":["import once from 'call-once-fn';\nimport { type FileAttributes, FileEntry, type Lock, type NoParamCallback, waitForAccess } from 'extract-base-iterator';\nimport fs from 'graceful-fs';\nimport oo from 'on-one';\n\nimport type { ExtractOptions } from './types.ts';\n\nexport default class TarFileEntry extends FileEntry {\n private lock: Lock;\n private stream: NodeJS.ReadableStream;\n\n constructor(attributes: FileAttributes, stream: NodeJS.ReadableStream, lock: Lock) {\n super(attributes);\n this.stream = stream;\n this.lock = lock;\n this.lock.retain();\n }\n\n create(dest: string, callback: NoParamCallback): void;\n create(dest: string, options: ExtractOptions, callback: NoParamCallback): void;\n create(dest: string, options?: ExtractOptions): Promise<boolean>;\n create(dest: string, options?: ExtractOptions | NoParamCallback, callback?: NoParamCallback): void | Promise<boolean> {\n callback = typeof options === 'function' ? options : callback;\n options = typeof options === 'function' ? {} : ((options || {}) as ExtractOptions);\n\n if (typeof callback === 'function') {\n return FileEntry.prototype.create.call(this, dest, options, (err?: Error) => {\n callback(err);\n if (this.lock) {\n this.lock.release();\n this.lock = null;\n }\n });\n }\n\n return new Promise((resolve, reject) => this.create(dest, options, (err?: Error, done?: boolean) => (err ? reject(err) : resolve(done))));\n }\n\n _writeFile(fullPath: string, _options: ExtractOptions, callback: NoParamCallback): void {\n if (!this.stream) {\n callback(new Error('FileEntry missing stream. Check for calling create multiple times'));\n return;\n }\n\n const stream = this.stream;\n this.stream = null; // Prevent reuse\n\n // Use once since errors can come from either stream\n const cb = once((err?: Error) => {\n err ? callback(err) : waitForAccess(fullPath, callback); // gunzip stream returns prematurely occasionally\n });\n\n try {\n const writeStream = fs.createWriteStream(fullPath);\n\n // Listen for errors on source stream (errors don't propagate through pipe)\n stream.on('error', (streamErr: Error) => {\n // Destroy the write stream on source error.\n // On Node 0.8, destroy() emits 'close' before 'error'. Since on-one is listening\n // for ['error', 'close', 'finish'], it catches 'close' first, calls our callback,\n // and removes ALL listeners - including the 'error' listener. The subsequent EBADF\n // error then fires with no handler, causing an uncaught exception.\n // Adding a no-op error handler ensures there's always a listener for any error.\n const ws = writeStream as fs.WriteStream & { destroy?: () => void };\n writeStream.on('error', () => {});\n if (typeof ws.destroy === 'function') ws.destroy();\n cb(streamErr);\n });\n\n // Pipe and listen for write stream completion/errors\n stream.pipe(writeStream);\n oo(writeStream, ['error', 'close', 'finish'], cb);\n } catch (err) {\n cb(err);\n }\n }\n\n destroy() {\n FileEntry.prototype.destroy.call(this);\n if (this.stream) {\n this.stream.resume(); // drain stream\n this.stream = null;\n }\n if (this.lock) {\n this.lock.release();\n this.lock = null;\n }\n }\n}\n"],"names":["TarFileEntry","attributes","stream","lock","retain","create","dest","options","callback","FileEntry","prototype","call","err","release","Promise","resolve","reject","done","_writeFile","fullPath","_options","Error","cb","once","waitForAccess","writeStream","fs","createWriteStream","on","streamErr","ws","destroy","pipe","oo","resume"],"mappings":";;;;;;;eAOqBA;;;iEAPJ;mCAC8E;iEAChF;4DACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;A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,2EAA2E;YAC3EjB,OAAO0B,EAAE,CAAC,SAAS,SAACC;gBAClB,4CAA4C;gBAC5C,iFAAiF;gBACjF,kFAAkF;gBAClF,mFAAmF;gBACnF,mEAAmE;gBACnE,gFAAgF;gBAChF,IAAMC,KAAKL;gBACXA,YAAYG,EAAE,CAAC,SAAS,YAAO;gBAC/B,IAAI,OAAOE,GAAGC,OAAO,KAAK,YAAYD,GAAGC,OAAO;gBAChDT,GAAGO;YACL;YAEA,qDAAqD;YACrD3B,OAAO8B,IAAI,CAACP;YACZQ,IAAAA,cAAE,EAACR,aAAa;gBAAC;gBAAS;gBAAS;aAAS,EAAEH;QAChD,EAAE,OAAOV,KAAK;YACZU,GAAGV;QACL;IACF;IAEAmB,OAAAA,OAUC,GAVDA,SAAAA;QACEtB,8BAAS,CAACC,SAAS,CAACqB,OAAO,CAACpB,IAAI,CAAC,IAAI;QACrC,IAAI,IAAI,CAACT,MAAM,EAAE;YACf,IAAI,CAACA,MAAM,CAACgC,MAAM,IAAI,eAAe;YACrC,IAAI,CAAChC,MAAM,GAAG;QAChB;QACA,IAAI,IAAI,CAACC,IAAI,EAAE;YACb,IAAI,CAACA,IAAI,CAACU,OAAO;YACjB,IAAI,CAACV,IAAI,GAAG;QACd;IACF;WAhFmBH;EAAqBS,8BAAS"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/tar-iterator/src/FileEntry.ts"],"sourcesContent":["import once from 'call-once-fn';\nimport { type FileAttributes, FileEntry, type Lock, type NoParamCallback, waitForAccess } from 'extract-base-iterator';\nimport fs from 'graceful-fs';\nimport oo from 'on-one';\n\nimport type { ExtractOptions } from './types.ts';\n\nexport default class TarFileEntry extends FileEntry {\n private lock: Lock;\n private stream: NodeJS.ReadableStream;\n\n constructor(attributes: FileAttributes, stream: NodeJS.ReadableStream, lock: Lock) {\n super(attributes);\n this.stream = stream;\n this.lock = lock;\n this.lock.retain();\n }\n\n create(dest: string, callback: NoParamCallback): void;\n create(dest: string, options: ExtractOptions, callback: NoParamCallback): void;\n create(dest: string, options?: ExtractOptions): Promise<boolean>;\n create(dest: string, options?: ExtractOptions | NoParamCallback, callback?: NoParamCallback): void | Promise<boolean> {\n callback = typeof options === 'function' ? options : callback;\n options = typeof options === 'function' ? {} : ((options || {}) as ExtractOptions);\n\n if (typeof callback === 'function') {\n FileEntry.prototype.create.call(this, dest, options, (err?: Error) => {\n callback(err);\n if (this.lock) {\n this.lock.release();\n this.lock = null;\n }\n });\n return;\n }\n\n return new Promise((resolve, reject) => this.create(dest, options, (err?: Error, done?: boolean) => (err ? reject(err) : resolve(done))));\n }\n\n _writeFile(fullPath: string, _options: ExtractOptions, callback: NoParamCallback): void {\n if (!this.stream) {\n callback(new Error('FileEntry missing stream. Check for calling create multiple times'));\n return;\n }\n\n const stream = this.stream;\n this.stream = null; // Prevent reuse\n\n // Use once since errors can come from either stream\n const cb = once((err?: Error) => {\n err ? callback(err) : waitForAccess(fullPath, callback); // gunzip stream returns prematurely occasionally\n });\n\n try {\n const writeStream = fs.createWriteStream(fullPath);\n\n // Listen for errors on source stream (errors don't propagate through pipe)\n stream.on('error', (streamErr: Error) => {\n // Destroy the write stream on source error.\n // On Node 0.8, destroy() emits 'close' before 'error'. Since on-one is listening\n // for ['error', 'close', 'finish'], it catches 'close' first, calls our callback,\n // and removes ALL listeners - including the 'error' listener. The subsequent EBADF\n // error then fires with no handler, causing an uncaught exception.\n // Adding a no-op error handler ensures there's always a listener for any error.\n const ws = writeStream as fs.WriteStream & { destroy?: () => void };\n writeStream.on('error', () => {});\n if (typeof ws.destroy === 'function') ws.destroy();\n cb(streamErr);\n });\n\n // Pipe and listen for write stream completion/errors\n stream.pipe(writeStream);\n oo(writeStream, ['error', 'close', 'finish'], cb);\n } catch (err) {\n cb(err);\n }\n }\n\n destroy() {\n FileEntry.prototype.destroy.call(this);\n if (this.stream) {\n this.stream.resume(); // drain stream\n this.stream = null;\n }\n if (this.lock) {\n this.lock.release();\n this.lock = null;\n }\n }\n}\n"],"names":["TarFileEntry","attributes","stream","lock","retain","create","dest","options","callback","FileEntry","prototype","call","err","release","Promise","resolve","reject","done","_writeFile","fullPath","_options","Error","cb","once","waitForAccess","writeStream","fs","createWriteStream","on","streamErr","ws","destroy","pipe","oo","resume"],"mappings":";;;;;;;eAOqBA;;;iEAPJ;mCAC8E;iEAChF;4DACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,IAAA,AAAMA,6BAAN;;cAAMA;aAAAA,aAIPC,UAA0B,EAAEC,MAA6B,EAAEC,IAAU;gCAJ9DH;;gBAKjB,kBALiBA;YAKXC;;QACN,MAAKC,MAAM,GAAGA;QACd,MAAKC,IAAI,GAAGA;QACZ,MAAKA,IAAI,CAACC,MAAM;;;iBARCJ;IAcnBK,OAAAA,MAgBC,GAhBDA,SAAAA,OAAOC,IAAY,EAAEC,OAA0C,EAAEC,QAA0B;;QACzFA,WAAW,OAAOD,YAAY,aAAaA,UAAUC;QACrDD,UAAU,OAAOA,YAAY,aAAa,CAAC,IAAMA,WAAW,CAAC;QAE7D,IAAI,OAAOC,aAAa,YAAY;YAClCC,8BAAS,CAACC,SAAS,CAACL,MAAM,CAACM,IAAI,CAAC,IAAI,EAAEL,MAAMC,SAAS,SAACK;gBACpDJ,SAASI;gBACT,IAAI,MAAKT,IAAI,EAAE;oBACb,MAAKA,IAAI,CAACU,OAAO;oBACjB,MAAKV,IAAI,GAAG;gBACd;YACF;YACA;QACF;QAEA,OAAO,IAAIW,QAAQ,SAACC,SAASC;mBAAW,MAAKX,MAAM,CAACC,MAAMC,SAAS,SAACK,KAAaK;uBAAoBL,MAAMI,OAAOJ,OAAOG,QAAQE;;;IACnI;IAEAC,OAAAA,UAqCC,GArCDA,SAAAA,WAAWC,QAAgB,EAAEC,QAAwB,EAAEZ,QAAyB;QAC9E,IAAI,CAAC,IAAI,CAACN,MAAM,EAAE;YAChBM,SAAS,IAAIa,MAAM;YACnB;QACF;QAEA,IAAMnB,SAAS,IAAI,CAACA,MAAM;QAC1B,IAAI,CAACA,MAAM,GAAG,MAAM,gBAAgB;QAEpC,oDAAoD;QACpD,IAAMoB,KAAKC,IAAAA,mBAAI,EAAC,SAACX;YACfA,MAAMJ,SAASI,OAAOY,IAAAA,kCAAa,EAACL,UAAUX,WAAW,iDAAiD;QAC5G;QAEA,IAAI;YACF,IAAMiB,cAAcC,mBAAE,CAACC,iBAAiB,CAACR;YAEzC,2EAA2E;YAC3EjB,OAAO0B,EAAE,CAAC,SAAS,SAACC;gBAClB,4CAA4C;gBAC5C,iFAAiF;gBACjF,kFAAkF;gBAClF,mFAAmF;gBACnF,mEAAmE;gBACnE,gFAAgF;gBAChF,IAAMC,KAAKL;gBACXA,YAAYG,EAAE,CAAC,SAAS,YAAO;gBAC/B,IAAI,OAAOE,GAAGC,OAAO,KAAK,YAAYD,GAAGC,OAAO;gBAChDT,GAAGO;YACL;YAEA,qDAAqD;YACrD3B,OAAO8B,IAAI,CAACP;YACZQ,IAAAA,cAAE,EAACR,aAAa;gBAAC;gBAAS;gBAAS;aAAS,EAAEH;QAChD,EAAE,OAAOV,KAAK;YACZU,GAAGV;QACL;IACF;IAEAmB,OAAAA,OAUC,GAVDA,SAAAA;QACEtB,8BAAS,CAACC,SAAS,CAACqB,OAAO,CAACpB,IAAI,CAAC,IAAI;QACrC,IAAI,IAAI,CAACT,MAAM,EAAE;YACf,IAAI,CAACA,MAAM,CAACgC,MAAM,IAAI,eAAe;YACrC,IAAI,CAAChC,MAAM,GAAG;QAChB;QACA,IAAI,IAAI,CAACC,IAAI,EAAE;YACb,IAAI,CAACA,IAAI,CAACU,OAAO;YACjB,IAAI,CAACV,IAAI,GAAG;QACd;IACF;WAjFmBH;EAAqBS,8BAAS"}
@@ -7,13 +7,14 @@ let TarFileEntry = class TarFileEntry extends FileEntry {
7
7
  callback = typeof options === 'function' ? options : callback;
8
8
  options = typeof options === 'function' ? {} : options || {};
9
9
  if (typeof callback === 'function') {
10
- return FileEntry.prototype.create.call(this, dest, options, (err)=>{
10
+ FileEntry.prototype.create.call(this, dest, options, (err)=>{
11
11
  callback(err);
12
12
  if (this.lock) {
13
13
  this.lock.release();
14
14
  this.lock = null;
15
15
  }
16
16
  });
17
+ return;
17
18
  }
18
19
  return new Promise((resolve, reject)=>this.create(dest, options, (err, done)=>err ? reject(err) : resolve(done)));
19
20
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/tar-iterator/src/FileEntry.ts"],"sourcesContent":["import once from 'call-once-fn';\nimport { type FileAttributes, FileEntry, type Lock, type NoParamCallback, waitForAccess } from 'extract-base-iterator';\nimport fs from 'graceful-fs';\nimport oo from 'on-one';\n\nimport type { ExtractOptions } from './types.ts';\n\nexport default class TarFileEntry extends FileEntry {\n private lock: Lock;\n private stream: NodeJS.ReadableStream;\n\n constructor(attributes: FileAttributes, stream: NodeJS.ReadableStream, lock: Lock) {\n super(attributes);\n this.stream = stream;\n this.lock = lock;\n this.lock.retain();\n }\n\n create(dest: string, callback: NoParamCallback): void;\n create(dest: string, options: ExtractOptions, callback: NoParamCallback): void;\n create(dest: string, options?: ExtractOptions): Promise<boolean>;\n create(dest: string, options?: ExtractOptions | NoParamCallback, callback?: NoParamCallback): void | Promise<boolean> {\n callback = typeof options === 'function' ? options : callback;\n options = typeof options === 'function' ? {} : ((options || {}) as ExtractOptions);\n\n if (typeof callback === 'function') {\n return FileEntry.prototype.create.call(this, dest, options, (err?: Error) => {\n callback(err);\n if (this.lock) {\n this.lock.release();\n this.lock = null;\n }\n });\n }\n\n return new Promise((resolve, reject) => this.create(dest, options, (err?: Error, done?: boolean) => (err ? reject(err) : resolve(done))));\n }\n\n _writeFile(fullPath: string, _options: ExtractOptions, callback: NoParamCallback): void {\n if (!this.stream) {\n callback(new Error('FileEntry missing stream. Check for calling create multiple times'));\n return;\n }\n\n const stream = this.stream;\n this.stream = null; // Prevent reuse\n\n // Use once since errors can come from either stream\n const cb = once((err?: Error) => {\n err ? callback(err) : waitForAccess(fullPath, callback); // gunzip stream returns prematurely occasionally\n });\n\n try {\n const writeStream = fs.createWriteStream(fullPath);\n\n // Listen for errors on source stream (errors don't propagate through pipe)\n stream.on('error', (streamErr: Error) => {\n // Destroy the write stream on source error.\n // On Node 0.8, destroy() emits 'close' before 'error'. Since on-one is listening\n // for ['error', 'close', 'finish'], it catches 'close' first, calls our callback,\n // and removes ALL listeners - including the 'error' listener. The subsequent EBADF\n // error then fires with no handler, causing an uncaught exception.\n // Adding a no-op error handler ensures there's always a listener for any error.\n const ws = writeStream as fs.WriteStream & { destroy?: () => void };\n writeStream.on('error', () => {});\n if (typeof ws.destroy === 'function') ws.destroy();\n cb(streamErr);\n });\n\n // Pipe and listen for write stream completion/errors\n stream.pipe(writeStream);\n oo(writeStream, ['error', 'close', 'finish'], cb);\n } catch (err) {\n cb(err);\n }\n }\n\n destroy() {\n FileEntry.prototype.destroy.call(this);\n if (this.stream) {\n this.stream.resume(); // drain stream\n this.stream = null;\n }\n if (this.lock) {\n this.lock.release();\n this.lock = null;\n }\n }\n}\n"],"names":["once","FileEntry","waitForAccess","fs","oo","TarFileEntry","create","dest","options","callback","prototype","call","err","lock","release","Promise","resolve","reject","done","_writeFile","fullPath","_options","stream","Error","cb","writeStream","createWriteStream","on","streamErr","ws","destroy","pipe","resume","attributes","retain"],"mappings":"AAAA,OAAOA,UAAU,eAAe;AAChC,SAA8BC,SAAS,EAAmCC,aAAa,QAAQ,wBAAwB;AACvH,OAAOC,QAAQ,cAAc;AAC7B,OAAOC,QAAQ,SAAS;AAIT,IAAA,AAAMC,eAAN,MAAMA,qBAAqBJ;IAcxCK,OAAOC,IAAY,EAAEC,OAA0C,EAAEC,QAA0B,EAA2B;QACpHA,WAAW,OAAOD,YAAY,aAAaA,UAAUC;QACrDD,UAAU,OAAOA,YAAY,aAAa,CAAC,IAAMA,WAAW,CAAC;QAE7D,IAAI,OAAOC,aAAa,YAAY;YAClC,OAAOR,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,IAAI,CAAC,IAAI;QACrC,IAAI,IAAI,CAACW,MAAM,EAAE;YACf,IAAI,CAACA,MAAM,CAACU,MAAM,IAAI,eAAe;YACrC,IAAI,CAACV,MAAM,GAAG;QAChB;QACA,IAAI,IAAI,CAACT,IAAI,EAAE;YACb,IAAI,CAACA,IAAI,CAACC,OAAO;YACjB,IAAI,CAACD,IAAI,GAAG;QACd;IACF;IA5EA,YAAYoB,UAA0B,EAAEX,MAA6B,EAAET,IAAU,CAAE;QACjF,KAAK,CAACoB;QACN,IAAI,CAACX,MAAM,GAAGA;QACd,IAAI,CAACT,IAAI,GAAGA;QACZ,IAAI,CAACA,IAAI,CAACqB,MAAM;IAClB;AAwEF;AAjFA,SAAqB7B,0BAiFpB"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/tar-iterator/src/FileEntry.ts"],"sourcesContent":["import once from 'call-once-fn';\nimport { type FileAttributes, FileEntry, type Lock, type NoParamCallback, waitForAccess } from 'extract-base-iterator';\nimport fs from 'graceful-fs';\nimport oo from 'on-one';\n\nimport type { ExtractOptions } from './types.ts';\n\nexport default class TarFileEntry extends FileEntry {\n private lock: Lock;\n private stream: NodeJS.ReadableStream;\n\n constructor(attributes: FileAttributes, stream: NodeJS.ReadableStream, lock: Lock) {\n super(attributes);\n this.stream = stream;\n this.lock = lock;\n this.lock.retain();\n }\n\n create(dest: string, callback: NoParamCallback): void;\n create(dest: string, options: ExtractOptions, callback: NoParamCallback): void;\n create(dest: string, options?: ExtractOptions): Promise<boolean>;\n create(dest: string, options?: ExtractOptions | NoParamCallback, callback?: NoParamCallback): void | Promise<boolean> {\n callback = typeof options === 'function' ? options : callback;\n options = typeof options === 'function' ? {} : ((options || {}) as ExtractOptions);\n\n if (typeof callback === 'function') {\n FileEntry.prototype.create.call(this, dest, options, (err?: Error) => {\n callback(err);\n if (this.lock) {\n this.lock.release();\n this.lock = null;\n }\n });\n return;\n }\n\n return new Promise((resolve, reject) => this.create(dest, options, (err?: Error, done?: boolean) => (err ? reject(err) : resolve(done))));\n }\n\n _writeFile(fullPath: string, _options: ExtractOptions, callback: NoParamCallback): void {\n if (!this.stream) {\n callback(new Error('FileEntry missing stream. Check for calling create multiple times'));\n return;\n }\n\n const stream = this.stream;\n this.stream = null; // Prevent reuse\n\n // Use once since errors can come from either stream\n const cb = once((err?: Error) => {\n err ? callback(err) : waitForAccess(fullPath, callback); // gunzip stream returns prematurely occasionally\n });\n\n try {\n const writeStream = fs.createWriteStream(fullPath);\n\n // Listen for errors on source stream (errors don't propagate through pipe)\n stream.on('error', (streamErr: Error) => {\n // Destroy the write stream on source error.\n // On Node 0.8, destroy() emits 'close' before 'error'. Since on-one is listening\n // for ['error', 'close', 'finish'], it catches 'close' first, calls our callback,\n // and removes ALL listeners - including the 'error' listener. The subsequent EBADF\n // error then fires with no handler, causing an uncaught exception.\n // Adding a no-op error handler ensures there's always a listener for any error.\n const ws = writeStream as fs.WriteStream & { destroy?: () => void };\n writeStream.on('error', () => {});\n if (typeof ws.destroy === 'function') ws.destroy();\n cb(streamErr);\n });\n\n // Pipe and listen for write stream completion/errors\n stream.pipe(writeStream);\n oo(writeStream, ['error', 'close', 'finish'], cb);\n } catch (err) {\n cb(err);\n }\n }\n\n destroy() {\n FileEntry.prototype.destroy.call(this);\n if (this.stream) {\n this.stream.resume(); // drain stream\n this.stream = null;\n }\n if (this.lock) {\n this.lock.release();\n this.lock = null;\n }\n }\n}\n"],"names":["once","FileEntry","waitForAccess","fs","oo","TarFileEntry","create","dest","options","callback","prototype","call","err","lock","release","Promise","resolve","reject","done","_writeFile","fullPath","_options","stream","Error","cb","writeStream","createWriteStream","on","streamErr","ws","destroy","pipe","resume","attributes","retain"],"mappings":"AAAA,OAAOA,UAAU,eAAe;AAChC,SAA8BC,SAAS,EAAmCC,aAAa,QAAQ,wBAAwB;AACvH,OAAOC,QAAQ,cAAc;AAC7B,OAAOC,QAAQ,SAAS;AAIT,IAAA,AAAMC,eAAN,MAAMA,qBAAqBJ;I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EA,qDAAqD;YACrDN,OAAOS,IAAI,CAACN;YACZrB,GAAGqB,aAAa;gBAAC;gBAAS;gBAAS;aAAS,EAAED;QAChD,EAAE,OAAOZ,KAAK;YACZY,GAAGZ;QACL;IACF;IAEAkB,UAAU;QACR7B,UAAUS,SAAS,CAACoB,OAAO,CAACnB,IAAI,CAAC,IAAI;QACrC,IAAI,IAAI,CAACW,MAAM,EAAE;YACf,IAAI,CAACA,MAAM,CAACU,MAAM,IAAI,eAAe;YACrC,IAAI,CAACV,MAAM,GAAG;QAChB;QACA,IAAI,IAAI,CAACT,IAAI,EAAE;YACb,IAAI,CAACA,IAAI,CAACC,OAAO;YACjB,IAAI,CAACD,IAAI,GAAG;QACd;IACF;IA7EA,YAAYoB,UAA0B,EAAEX,MAA6B,EAAET,IAAU,CAAE;QACjF,KAAK,CAACoB;QACN,IAAI,CAACX,MAAM,GAAGA;QACd,IAAI,CAACT,IAAI,GAAGA;QACZ,IAAI,CAACA,IAAI,CAACqB,MAAM;IAClB;AAyEF;AAlFA,SAAqB7B,0BAkFpB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tar-iterator",
3
- "version": "3.3.5",
3
+ "version": "3.3.7",
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",
@@ -62,7 +62,7 @@
62
62
  },
63
63
  "dependencies": {
64
64
  "call-once-fn": "^1.0.1",
65
- "extract-base-iterator": "^3.0.0",
65
+ "extract-base-iterator": "^3.4.4",
66
66
  "graceful-fs": "^4.2.11",
67
67
  "on-one": "^1.0.0"
68
68
  },