tar-iterator 3.2.0 → 3.3.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.
@@ -4,7 +4,9 @@ export default class TarFileEntry extends FileEntry {
4
4
  private lock;
5
5
  private stream;
6
6
  constructor(attributes: FileAttributes, stream: NodeJS.ReadableStream, lock: Lock);
7
- create(dest: string, options: ExtractOptions | NoParamCallback, callback: NoParamCallback): undefined | Promise<boolean>;
8
- _writeFile(fullPath: string, _options: ExtractOptions, callback: NoParamCallback): undefined;
7
+ create(dest: string, callback: NoParamCallback): void;
8
+ create(dest: string, options: ExtractOptions, callback: NoParamCallback): void;
9
+ create(dest: string, options?: ExtractOptions): Promise<boolean>;
10
+ _writeFile(fullPath: string, _options: ExtractOptions, callback: NoParamCallback): void;
9
11
  destroy(): void;
10
12
  }
@@ -4,7 +4,9 @@ export default class TarFileEntry extends FileEntry {
4
4
  private lock;
5
5
  private stream;
6
6
  constructor(attributes: FileAttributes, stream: NodeJS.ReadableStream, lock: Lock);
7
- create(dest: string, options: ExtractOptions | NoParamCallback, callback: NoParamCallback): undefined | Promise<boolean>;
8
- _writeFile(fullPath: string, _options: ExtractOptions, callback: NoParamCallback): undefined;
7
+ create(dest: string, callback: NoParamCallback): void;
8
+ create(dest: string, options: ExtractOptions, callback: NoParamCallback): void;
9
+ create(dest: string, options?: ExtractOptions): Promise<boolean>;
10
+ _writeFile(fullPath: string, _options: ExtractOptions, callback: NoParamCallback): void;
9
11
  destroy(): void;
10
12
  }
@@ -137,7 +137,6 @@ var TarFileEntry = /*#__PURE__*/ function(FileEntry) {
137
137
  stream.pipe(writeStream);
138
138
  (0, _onone.default)(writeStream, [
139
139
  'error',
140
- 'end',
141
140
  'close',
142
141
  'finish'
143
142
  ], cb);
@@ -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 '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, options: ExtractOptions | NoParamCallback, callback: NoParamCallback): undefined | Promise<boolean> {\n if (typeof options === 'function') {\n callback = options;\n options = null;\n }\n if (typeof callback === 'function') {\n options = options || {};\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) => {\n this.create(dest, options, (err?: Error, done?: boolean) => (err ? reject(err) : resolve(done)));\n });\n }\n\n _writeFile(fullPath: string, _options: ExtractOptions, callback: NoParamCallback): undefined {\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', (err: Error) => {\n // Destroy the write stream on source error\n const ws = writeStream as fs.WriteStream & { destroy?: () => void };\n if (typeof ws.destroy === 'function') ws.destroy();\n cb(err);\n });\n\n // Pipe and listen for write stream completion/errors\n stream.pipe(writeStream);\n oo(writeStream, ['error', 'end', '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","ws","destroy","pipe","oo","resume"],"mappings":";;;;;;;eAOqBA;;;iEAPJ;mCAC8E;yDAChF;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;IAWnBK,OAAAA,MAmBC,GAnBDA,SAAAA,OAAOC,IAAY,EAAEC,OAAyC,EAAEC,QAAyB;;QACvF,IAAI,OAAOD,YAAY,YAAY;YACjCC,WAAWD;YACXA,UAAU;QACZ;QACA,IAAI,OAAOC,aAAa,YAAY;YAClCD,UAAUA,WAAW,CAAC;YACtB,OAAOE,8BAAS,CAACC,SAAS,CAACL,MAAM,CAACM,IAAI,CAAC,IAAI,EAAEL,MAAMC,SAAS,SAACK;gBAC3DJ,SAASI;gBACT,IAAI,MAAKT,IAAI,EAAE;oBACb,MAAKA,IAAI,CAACU,OAAO;oBACjB,MAAKV,IAAI,GAAG;gBACd;YACF;QACF;QAEA,OAAO,IAAIW,QAAQ,SAACC,SAASC;YAC3B,MAAKX,MAAM,CAACC,MAAMC,SAAS,SAACK,KAAaK;uBAAoBL,MAAMI,OAAOJ,OAAOG,QAAQE;;QAC3F;IACF;IAEAC,OAAAA,UA+BC,GA/BDA,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,WAAE,CAACC,iBAAiB,CAACR;YAEzC,2EAA2E;YAC3EjB,OAAO0B,EAAE,CAAC,SAAS,SAAChB;gBAClB,2CAA2C;gBAC3C,IAAMiB,KAAKJ;gBACX,IAAI,OAAOI,GAAGC,OAAO,KAAK,YAAYD,GAAGC,OAAO;gBAChDR,GAAGV;YACL;YAEA,qDAAqD;YACrDV,OAAO6B,IAAI,CAACN;YACZO,IAAAA,cAAE,EAACP,aAAa;gBAAC;gBAAS;gBAAO;gBAAS;aAAS,EAAEH;QACvD,EAAE,OAAOV,KAAK;YACZU,GAAGV;QACL;IACF;IAEAkB,OAAAA,OAUC,GAVDA,SAAAA;QACErB,8BAAS,CAACC,SAAS,CAACoB,OAAO,CAACnB,IAAI,CAAC,IAAI;QACrC,IAAI,IAAI,CAACT,MAAM,EAAE;YACf,IAAI,CAACA,MAAM,CAAC+B,MAAM,IAAI,eAAe;YACrC,IAAI,CAAC/B,MAAM,GAAG;QAChB;QACA,IAAI,IAAI,CAACC,IAAI,EAAE;YACb,IAAI,CAACA,IAAI,CAACU,OAAO;YACjB,IAAI,CAACV,IAAI,GAAG;QACd;IACF;WA3EmBH;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 '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 if (typeof options === 'function') {\n callback = options;\n options = null;\n }\n if (typeof callback === 'function') {\n options = options || {};\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) => {\n this.create(dest, options as ExtractOptions, (err?: Error, done?: boolean) => (err ? reject(err) : resolve(done)));\n });\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', (err: Error) => {\n // Destroy the write stream on source error\n const ws = writeStream as fs.WriteStream & { destroy?: () => void };\n if (typeof ws.destroy === 'function') ws.destroy();\n cb(err);\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","ws","destroy","pipe","oo","resume"],"mappings":";;;;;;;eAOqBA;;;iEAPJ;mCAC8E;yDAChF;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,MAmBC,GAnBDA,SAAAA,OAAOC,IAAY,EAAEC,OAA0C,EAAEC,QAA0B;;QACzF,IAAI,OAAOD,YAAY,YAAY;YACjCC,WAAWD;YACXA,UAAU;QACZ;QACA,IAAI,OAAOC,aAAa,YAAY;YAClCD,UAAUA,WAAW,CAAC;YACtB,OAAOE,8BAAS,CAACC,SAAS,CAACL,MAAM,CAACM,IAAI,CAAC,IAAI,EAAEL,MAAMC,SAAS,SAACK;gBAC3DJ,SAASI;gBACT,IAAI,MAAKT,IAAI,EAAE;oBACb,MAAKA,IAAI,CAACU,OAAO;oBACjB,MAAKV,IAAI,GAAG;gBACd;YACF;QACF;QAEA,OAAO,IAAIW,QAAQ,SAACC,SAASC;YAC3B,MAAKX,MAAM,CAACC,MAAMC,SAA2B,SAACK,KAAaK;uBAAoBL,MAAMI,OAAOJ,OAAOG,QAAQE;;QAC7G;IACF;IAEAC,OAAAA,UA+BC,GA/BDA,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,WAAE,CAACC,iBAAiB,CAACR;YAEzC,2EAA2E;YAC3EjB,OAAO0B,EAAE,CAAC,SAAS,SAAChB;gBAClB,2CAA2C;gBAC3C,IAAMiB,KAAKJ;gBACX,IAAI,OAAOI,GAAGC,OAAO,KAAK,YAAYD,GAAGC,OAAO;gBAChDR,GAAGV;YACL;YAEA,qDAAqD;YACrDV,OAAO6B,IAAI,CAACN;YACZO,IAAAA,cAAE,EAACP,aAAa;gBAAC;gBAAS;gBAAS;aAAS,EAAEH;QAChD,EAAE,OAAOV,KAAK;YACZU,GAAGV;QACL;IACF;IAEAkB,OAAAA,OAUC,GAVDA,SAAAA;QACErB,8BAAS,CAACC,SAAS,CAACoB,OAAO,CAACnB,IAAI,CAAC,IAAI;QACrC,IAAI,IAAI,CAACT,MAAM,EAAE;YACf,IAAI,CAACA,MAAM,CAAC+B,MAAM,IAAI,eAAe;YACrC,IAAI,CAAC/B,MAAM,GAAG;QAChB;QACA,IAAI,IAAI,CAACC,IAAI,EAAE;YACb,IAAI,CAACA,IAAI,CAACU,OAAO;YACjB,IAAI,CAACV,IAAI,GAAG;QACd;IACF;WA9EmBH;EAAqBS,8BAAS"}
@@ -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, { Lock } from 'extract-base-iterator';\nimport fs from 'fs';\n\nimport nextEntry from './nextEntry.ts';\nimport TarExtract from './tar/TarExtract.ts';\n\nimport type { Entry, ExtractOptions } from './types.ts';\n\nexport default class TarIterator extends BaseIterator<Entry> {\n /** @internal @hidden */\n lock: Lock | null;\n /** @internal @hidden */\n extract: TarExtract | null;\n\n constructor(source: string | NodeJS.ReadableStream, options: ExtractOptions = {}) {\n super(options);\n this.lock = new Lock();\n this.lock.onDestroy = (err) => BaseIterator.prototype.end.call(this, err);\n\n let cancelled = false;\n const setup = (): undefined => {\n cancelled = true;\n };\n this.processing.push(setup);\n\n // Use our pure TarExtract instead of tar-stream-compat\n // Note: options passed here are ExtractOptions (strip, force, etc.)\n // TarExtract uses TarExtractOptions (filenameEncoding, etc.) which is different\n this.extract = new TarExtract();\n\n const pipe = (cb) => {\n try {\n if (typeof source === 'string') source = fs.createReadStream(source);\n } catch (err) {\n cb(err);\n }\n\n // Register cleanup for source stream\n const stream = source as NodeJS.ReadableStream;\n this.lock.registerCleanup(() => {\n const s = stream as NodeJS.ReadableStream & { destroy?: () => void };\n if (typeof s.destroy === 'function') s.destroy();\n });\n\n const end = once(cb);\n const self = this;\n let firstData = true;\n (source as NodeJS.ReadableStream).on('data', function onData(chunk) {\n try {\n if (self.extract) self.extract.write(chunk);\n if (firstData) {\n firstData = false;\n end();\n }\n } catch (err) {\n // Handle synchronous errors from TarExtract (e.g., invalid format)\n end(err);\n }\n });\n (source as NodeJS.ReadableStream).on('error', end);\n (source as NodeJS.ReadableStream).on('end', function onEnd() {\n if (self.extract) self.extract.end();\n });\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 const lock = this.lock;\n if (lock) {\n this.lock = null; // Clear FIRST to prevent re-entrancy\n lock.err = err;\n lock.release(); // Lock.__destroy() handles BaseIterator.end()\n }\n this.extract = null;\n }\n}\n"],"names":["TarIterator","source","options","lock","Lock","onDestroy","err","BaseIterator","prototype","end","call","cancelled","setup","processing","push","extract","TarExtract","pipe","cb","fs","createReadStream","stream","registerCleanup","s","destroy","once","self","firstData","on","onData","chunk","write","onEnd","remove","done","nextEntry","bind","release"],"mappings":";;;;;;;eASq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AIH;gBACN;YACF;YACCL,OAAiC2B,EAAE,CAAC,SAASnB;YAC7CR,OAAiC2B,EAAE,CAAC,OAAO,SAASI;gBACnD,IAAIN,KAAKX,OAAO,EAAEW,KAAKX,OAAO,CAACN,GAAG;YACpC;QACF;QACAQ,KAAK,SAACX;YACJ,MAAKO,UAAU,CAACoB,MAAM,CAACrB;YACvB,IAAI,MAAKsB,IAAI,IAAIvB,WAAW,QAAQ,OAAO;YAC3CL,MAAM,MAAKG,GAAG,CAACH,OAAO,MAAKQ,IAAI,CAACqB,oBAAS,CAACC,IAAI,CAAC,MAAM;QACvD;;;iBA5DiBpC;IA+DnBS,OAAAA,GAQC,GARDA,SAAAA,IAAIH,GAAW;QACb,IAAMH,OAAO,IAAI,CAACA,IAAI;QACtB,IAAIA,MAAM;YACR,IAAI,CAACA,IAAI,GAAG,MAAM,qCAAqC;YACvDA,KAAKG,GAAG,GAAGA;YACXH,KAAKkC,OAAO,IAAI,8CAA8C;QAChE;QACA,IAAI,CAACtB,OAAO,GAAG;IACjB;WAvEmBf;EAAoBO,4BAAY"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/tar-iterator/src/TarIterator.ts"],"sourcesContent":["import once from 'call-once-fn';\nimport BaseIterator, { Lock } from 'extract-base-iterator';\nimport fs from 'fs';\n\nimport nextEntry from './nextEntry.ts';\nimport TarExtract from './tar/TarExtract.ts';\n\nimport type { Entry, ExtractOptions } from './types.ts';\n\nexport default class TarIterator extends BaseIterator<Entry> {\n /** @internal @hidden */\n lock: Lock | null;\n /** @internal @hidden */\n extract: TarExtract | null;\n\n constructor(source: string | NodeJS.ReadableStream, options: ExtractOptions = {}) {\n super(options);\n this.lock = new Lock();\n this.lock.onDestroy = (err) => BaseIterator.prototype.end.call(this, err);\n\n let cancelled = false;\n const setup = (): void => {\n cancelled = true;\n };\n this.processing.push(setup);\n\n // Use our pure TarExtract instead of tar-stream-compat\n // Note: options passed here are ExtractOptions (strip, force, etc.)\n // TarExtract uses TarExtractOptions (filenameEncoding, etc.) which is different\n this.extract = new TarExtract();\n\n const pipe = (cb) => {\n try {\n if (typeof source === 'string') source = fs.createReadStream(source);\n } catch (err) {\n cb(err);\n }\n\n // Register cleanup for source stream\n const stream = source as NodeJS.ReadableStream;\n this.lock.registerCleanup(() => {\n const s = stream as NodeJS.ReadableStream & { destroy?: () => void };\n if (typeof s.destroy === 'function') s.destroy();\n });\n\n const end = once(cb);\n const self = this;\n let firstData = true;\n (source as NodeJS.ReadableStream).on('data', function onData(chunk) {\n try {\n if (self.extract) self.extract.write(chunk);\n if (firstData) {\n firstData = false;\n end();\n }\n } catch (err) {\n // Handle synchronous errors from TarExtract (e.g., invalid format)\n end(err);\n }\n });\n (source as NodeJS.ReadableStream).on('error', end);\n (source as NodeJS.ReadableStream).on('end', function onEnd() {\n if (self.extract) self.extract.end();\n });\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 const lock = this.lock;\n if (lock) {\n this.lock = null; // Clear FIRST to prevent re-entrancy\n lock.err = err;\n lock.release(); // Lock.__destroy() handles BaseIterator.end()\n }\n this.extract = null;\n }\n}\n"],"names":["TarIterator","source","options","lock","Lock","onDestroy","err","BaseIterator","prototype","end","call","cancelled","setup","processing","push","extract","TarExtract","pipe","cb","fs","createReadStream","stream","registerCleanup","s","destroy","once","self","firstData","on","onData","chunk","write","onEnd","remove","done","nextEntry","bind","release"],"mappings":";;;;;;;eASqBA;;;iEATJ;2EACkB;yDACpB;kEAEO;mEACC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIR,IAAA,AAAMA,4BAAN;;cAAMA;aAAAA,YAMPC,MAAsC;YAAEC,UAAAA,iEAA0B,CAAC;gCAN5DF;;gBAOjB,kBAPiB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C3CL,MAAM,MAAKG,GAAG,CAACH,OAAO,MAAKQ,IAAI,CAACqB,oBAAS,CAACC,IAAI,CAAC,MAAM;QACvD;;;iBA5DiBpC;IA+DnBS,OAAAA,GAQC,GARDA,SAAAA,IAAIH,GAAW;QACb,IAAMH,OAAO,IAAI,CAACA,IAAI;QACtB,IAAIA,MAAM;YACR,IAAI,CAACA,IAAI,GAAG,MAAM,qCAAqC;YACvDA,KAAKG,GAAG,GAAGA;YACXH,KAAKkC,OAAO,IAAI,8CAA8C;QAChE;QACA,IAAI,CAACtB,OAAO,GAAG;IACjB;WAvEmBf;EAAoBO,4BAAY"}
@@ -1,5 +1,5 @@
1
1
  import type Iterator from './TarIterator.js';
2
2
  import type { Entry, EntryCallback } from './types.js';
3
- export type TarNext = () => undefined;
4
- export type NextCallback = (error?: Error, entry?: Entry, next?: TarNext) => undefined;
5
- export default function nextEntry(next: TarNext, iterator: Iterator, callback: EntryCallback): undefined;
3
+ export type TarNext = () => void;
4
+ export type NextCallback = (error?: Error, entry?: Entry, next?: TarNext) => void;
5
+ export default function nextEntry(next: TarNext, iterator: Iterator, callback: EntryCallback): void;
@@ -1,5 +1,5 @@
1
1
  import type Iterator from './TarIterator.js';
2
2
  import type { Entry, EntryCallback } from './types.js';
3
- export type TarNext = () => undefined;
4
- export type NextCallback = (error?: Error, entry?: Entry, next?: TarNext) => undefined;
5
- export default function nextEntry(next: TarNext, iterator: Iterator, callback: EntryCallback): undefined;
3
+ export type TarNext = () => void;
4
+ export type NextCallback = (error?: Error, entry?: Entry, next?: TarNext) => void;
5
+ export default function nextEntry(next: TarNext, iterator: Iterator, callback: EntryCallback): void;
@@ -44,10 +44,6 @@ function _object_spread(target) {
44
44
  }
45
45
  return target;
46
46
  }
47
- // setImmediate is preferred (Node 0.10+), falls back to setTimeout for Node 0.8
48
- var defer = typeof setImmediate === 'function' ? setImmediate : function(fn) {
49
- return setTimeout(fn, 0);
50
- };
51
47
  function nextEntry(next, iterator, callback) {
52
48
  // Guard: bail early if iterator already ended
53
49
  if (!iterator.lock || iterator.isDone()) {
@@ -64,9 +60,8 @@ function nextEntry(next, iterator, callback) {
64
60
  extract.removeListener('finish', onEnd);
65
61
  // keep processing
66
62
  if (entry) iterator.push(nextEntry.bind(null, next));
67
- // Use setImmediate to defer the callback invocation
68
- // This ensures proper async behavior with the BaseIterator
69
- defer(function() {
63
+ // Defer the callback invocation to ensure proper async behavior with the BaseIterator
64
+ setTimeout(function() {
70
65
  err ? callback(err) : callback(null, entry ? {
71
66
  done: false,
72
67
  value: entry
@@ -74,7 +69,7 @@ function nextEntry(next, iterator, callback) {
74
69
  done: true,
75
70
  value: null
76
71
  });
77
- });
72
+ }, 0);
78
73
  });
79
74
  // Use nextCallback for all events to ensure once() wrapper is respected
80
75
  var onError = function(err) {
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/tar-iterator/src/nextEntry.ts"],"sourcesContent":["import once from 'call-once-fn';\nimport { DirectoryEntry, LinkEntry, normalizePath, SymbolicLinkEntry } from 'extract-base-iterator';\nimport FileEntry from './FileEntry.ts';\nimport type Iterator from './TarIterator.ts';\n\nimport type { Entry, EntryCallback } from './types.ts';\n\n// setImmediate is preferred (Node 0.10+), falls back to setTimeout for Node 0.8\nconst defer = typeof setImmediate === 'function' ? setImmediate : (fn: () => void) => setTimeout(fn, 0);\n\nexport type TarNext = () => undefined;\nexport type NextCallback = (error?: Error, entry?: Entry, next?: TarNext) => undefined;\n\nexport default function nextEntry(next: TarNext, iterator: Iterator, callback: EntryCallback): undefined {\n // Guard: bail early if iterator already ended\n if (!iterator.lock || iterator.isDone()) {\n return callback(null, { done: true, value: null });\n }\n\n const extract = iterator.extract;\n if (!extract) return callback(new Error('Extract missing'));\n\n const nextCallback = once((err?: Error, entry?: Entry, next?: TarNext) => {\n extract.removeListener('entry', onEntry);\n extract.removeListener('error', onError);\n extract.removeListener('finish', onEnd);\n\n // keep processing\n if (entry) iterator.push(nextEntry.bind(null, next));\n\n // Use setImmediate to defer the callback invocation\n // This ensures proper async behavior with the BaseIterator\n defer(() => {\n err ? callback(err) : callback(null, entry ? { done: false, value: entry } : { done: true, value: null });\n });\n }) as NextCallback;\n\n // Use nextCallback for all events to ensure once() wrapper is respected\n const onError = (err: Error) => nextCallback(err);\n const onEnd = () => nextCallback();\n const onEntry = function onEntry(header, stream, next: TarNext) {\n // Guard: skip if iterator already ended (stale lock)\n if (!iterator.lock || iterator.isDone()) {\n stream.resume(); // drain stream\n return nextCallback(null, null, next);\n }\n\n const attributes = { ...header };\n attributes.path = normalizePath(header.name);\n attributes.mtime = new Date(attributes.mtime);\n\n switch (attributes.type) {\n case 'directory':\n stream.resume(); // drain stream\n return nextCallback(null, new DirectoryEntry(attributes), next);\n case 'symlink':\n stream.resume(); // drain stream\n attributes.linkpath = header.linkname;\n return nextCallback(null, new SymbolicLinkEntry(attributes), next);\n case 'link':\n stream.resume(); // drain stream\n attributes.linkpath = header.linkname;\n return nextCallback(null, new LinkEntry(attributes), next);\n case 'file':\n return nextCallback(null, new FileEntry(attributes, stream, iterator.lock), next);\n }\n\n stream.resume(); // drain stream\n return nextCallback(new Error(`Unrecognized entry type: ${attributes.type}`), null, next);\n };\n\n extract.on('entry', onEntry);\n extract.on('error', onError);\n extract.on('finish', onEnd);\n\n // Resume parsing to emit any pending entry\n // For first call (next is null), this triggers the first entry emission\n // For subsequent calls, next() unlocks the parser which then processes the next header\n if (next) {\n next();\n } else {\n // First call - resume to emit any pending entry\n extract.resume();\n }\n}\n"],"names":["nextEntry","defer","setImmediate","fn","setTimeout","next","iterator","callback","lock","isDone","done","value","extract","Error","nextCallback","once","err","entry","removeListener","onEntry","onError","onEnd","push","bind","header","stream","resume","attributes","path","normalizePath","name","mtime","Date","type","DirectoryEntry","linkpath","linkname","SymbolicLinkEntry","LinkEntry","FileEntry","on"],"mappings":";;;;+BAaA;;;eAAwBA;;;iEAbP;mCAC2D;kEACtD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AAWI,KAAK;QAE5C,OAAQJ,WAAWM,IAAI;YACrB,KAAK;gBACHR,OAAOC,MAAM,IAAI,eAAe;gBAChC,OAAOZ,aAAa,MAAM,IAAIoB,mCAAc,CAACP,aAAatB;YAC5D,KAAK;gBACHoB,OAAOC,MAAM,IAAI,eAAe;gBAChCC,WAAWQ,QAAQ,GAAGX,OAAOY,QAAQ;gBACrC,OAAOtB,aAAa,MAAM,IAAIuB,sCAAiB,CAACV,aAAatB;YAC/D,KAAK;gBACHoB,OAAOC,MAAM,IAAI,eAAe;gBAChCC,WAAWQ,QAAQ,GAAGX,OAAOY,QAAQ;gBACrC,OAAOtB,aAAa,MAAM,IAAIwB,8BAAS,CAACX,aAAatB;YACvD,KAAK;gBACH,OAAOS,aAAa,MAAM,IAAIyB,oBAAS,CAACZ,YAAYF,QAAQnB,SAASE,IAAI,GAAGH;QAChF;QAEAoB,OAAOC,MAAM,IAAI,eAAe;QAChC,OAAOZ,aAAa,IAAID,MAAM,AAAC,4BAA2C,OAAhBc,WAAWM,IAAI,IAAK,MAAM5B;IACtF;IAEAO,QAAQ4B,EAAE,CAAC,SAASrB;IACpBP,QAAQ4B,EAAE,CAAC,SAASpB;IACpBR,QAAQ4B,EAAE,CAAC,UAAUnB;IAErB,2CAA2C;IAC3C,wEAAwE;IACxE,uFAAuF;IACvF,IAAIhB,MAAM;QACRA;IACF,OAAO;QACL,gDAAgD;QAChDO,QAAQc,MAAM;IAChB;AACF"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/tar-iterator/src/nextEntry.ts"],"sourcesContent":["import once from 'call-once-fn';\nimport { DirectoryEntry, LinkEntry, normalizePath, SymbolicLinkEntry } from 'extract-base-iterator';\nimport FileEntry from './FileEntry.ts';\nimport type Iterator from './TarIterator.ts';\n\nimport type { Entry, EntryCallback } from './types.ts';\n\nexport type TarNext = () => void;\nexport type NextCallback = (error?: Error, entry?: Entry, next?: TarNext) => void;\n\nexport default function nextEntry(next: TarNext, iterator: Iterator, callback: EntryCallback): void {\n // Guard: bail early if iterator already ended\n if (!iterator.lock || iterator.isDone()) {\n return callback(null, { done: true, value: null });\n }\n\n const extract = iterator.extract;\n if (!extract) return callback(new Error('Extract missing'));\n\n const nextCallback = once((err?: Error, entry?: Entry, next?: TarNext) => {\n extract.removeListener('entry', onEntry);\n extract.removeListener('error', onError);\n extract.removeListener('finish', onEnd);\n\n // keep processing\n if (entry) iterator.push(nextEntry.bind(null, next));\n\n // Defer the callback invocation to ensure proper async behavior with the BaseIterator\n setTimeout(() => {\n err ? callback(err) : callback(null, entry ? { done: false, value: entry } : { done: true, value: null });\n }, 0);\n }) as NextCallback;\n\n // Use nextCallback for all events to ensure once() wrapper is respected\n const onError = (err: Error) => nextCallback(err);\n const onEnd = () => nextCallback();\n const onEntry = function onEntry(header, stream, next: TarNext) {\n // Guard: skip if iterator already ended (stale lock)\n if (!iterator.lock || iterator.isDone()) {\n stream.resume(); // drain stream\n return nextCallback(null, null, next);\n }\n\n const attributes = { ...header };\n attributes.path = normalizePath(header.name);\n attributes.mtime = new Date(attributes.mtime);\n\n switch (attributes.type) {\n case 'directory':\n stream.resume(); // drain stream\n return nextCallback(null, new DirectoryEntry(attributes), next);\n case 'symlink':\n stream.resume(); // drain stream\n attributes.linkpath = header.linkname;\n return nextCallback(null, new SymbolicLinkEntry(attributes), next);\n case 'link':\n stream.resume(); // drain stream\n attributes.linkpath = header.linkname;\n return nextCallback(null, new LinkEntry(attributes), next);\n case 'file':\n return nextCallback(null, new FileEntry(attributes, stream, iterator.lock), next);\n }\n\n stream.resume(); // drain stream\n return nextCallback(new Error(`Unrecognized entry type: ${attributes.type}`), null, next);\n };\n\n extract.on('entry', onEntry);\n extract.on('error', onError);\n extract.on('finish', onEnd);\n\n // Resume parsing to emit any pending entry\n // For first call (next is null), this triggers the first entry emission\n // For subsequent calls, next() unlocks the parser which then processes the next header\n if (next) {\n next();\n } else {\n // First call - resume to emit any pending entry\n extract.resume();\n }\n}\n"],"names":["nextEntry","next","iterator","callback","lock","isDone","done","value","extract","Error","nextCallback","once","err","entry","removeListener","onEntry","onError","onEnd","push","bind","setTimeout","header","stream","resume","attributes","path","normalizePath","name","mtime","Date","type","DirectoryEntry","linkpath","linkname","SymbolicLinkEntry","LinkEntry","FileEntry","on"],"mappings":";;;;+BAUA;;;eAAwBA;;;iEAVP;mCAC2D;kEACtD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQP,SAASA,UAAUC,IAAa,EAAEC,QAAkB,EAAEC,QAAuB;IAC1F,8CAA8C;IAC9C,IAAI,CAACD,SAASE,IAAI,IAAIF,SAASG,MAAM,IAAI;QACvC,OAAOF,SAAS,MAAM;YAAEG,MAAM;YAAMC,OAAO;QAAK;IAClD;IAEA,IAAMC,UAAUN,SAASM,OAAO;IAChC,IAAI,CAACA,SAAS,OAAOL,SAAS,IAAIM,MAAM;IAExC,IAAMC,eAAeC,IAAAA,mBAAI,EAAC,SAACC,KAAaC,OAAeZ;QACrDO,QAAQM,cAAc,CAAC,SAASC;QAChCP,QAAQM,cAAc,CAAC,SAASE;QAChCR,QAAQM,cAAc,CAAC,UAAUG;QAEjC,kBAAkB;QAClB,IAAIJ,OAAOX,SAASgB,IAAI,CAAClB,UAAUmB,IAAI,CAAC,MAAMlB;QAE9C,sFAAsF;QACtFmB,WAAW;YACTR,MAAMT,SAASS,OAAOT,SAAS,MAAMU,QAAQ;gBAAEP,MAAM;gBAAOC,OAAOM;YAAM,IAAI;gBAAEP,MAAM;gBAAMC,OAAO;YAAK;QACzG,GAAG;IACL;IAEA,wEAAwE;IACxE,IAAMS,UAAU,SAACJ;eAAeF,aAAaE;;IAC7C,IAAMK,QAAQ;eAAMP;;IACpB,IAAMK,UAAU,SAASA,QAAQM,MAAM,EAAEC,MAAM,EAAErB,IAAa;QAC5D,qDAAqD;QACrD,IAAI,CAACC,SAASE,IAAI,IAAIF,SAASG,MAAM,IAAI;YACvCiB,OAAOC,MAAM,IAAI,eAAe;YAChC,OAAOb,aAAa,MAAM,MAAMT;QAClC;QAEA,IAAMuB,aAAa,mBAAKH;QACxBG,WAAWC,IAAI,GAAGC,IAAAA,kCAAa,EAACL,OAAOM,IAAI;QAC3CH,WAAWI,KAAK,GAAG,IAAIC,KAAKL,WAAWI,KAAK;QAE5C,OAAQJ,WAAWM,IAAI;YACrB,KAAK;gBACHR,OAAOC,MAAM,IAAI,eAAe;gBAChC,OAAOb,aAAa,MAAM,IAAIqB,mCAAc,CAACP,aAAavB;YAC5D,KAAK;gBACHqB,OAAOC,MAAM,IAAI,eAAe;gBAChCC,WAAWQ,QAAQ,GAAGX,OAAOY,QAAQ;gBACrC,OAAOvB,aAAa,MAAM,IAAIwB,sCAAiB,CAACV,aAAavB;YAC/D,KAAK;gBACHqB,OAAOC,MAAM,IAAI,eAAe;gBAChCC,WAAWQ,QAAQ,GAAGX,OAAOY,QAAQ;gBACrC,OAAOvB,aAAa,MAAM,IAAIyB,8BAAS,CAACX,aAAavB;YACvD,KAAK;gBACH,OAAOS,aAAa,MAAM,IAAI0B,oBAAS,CAACZ,YAAYF,QAAQpB,SAASE,IAAI,GAAGH;QAChF;QAEAqB,OAAOC,MAAM,IAAI,eAAe;QAChC,OAAOb,aAAa,IAAID,MAAM,AAAC,4BAA2C,OAAhBe,WAAWM,IAAI,IAAK,MAAM7B;IACtF;IAEAO,QAAQ6B,EAAE,CAAC,SAAStB;IACpBP,QAAQ6B,EAAE,CAAC,SAASrB;IACpBR,QAAQ6B,EAAE,CAAC,UAAUpB;IAErB,2CAA2C;IAC3C,wEAAwE;IACxE,uFAAuF;IACvF,IAAIhB,MAAM;QACRA;IACF,OAAO;QACL,gDAAgD;QAChDO,QAAQe,MAAM;IAChB;AACF"}
@@ -3,4 +3,4 @@ export { default as FileEntry } from './FileEntry.js';
3
3
  import type { DirectoryEntry, LinkEntry, SymbolicLinkEntry } from 'extract-base-iterator';
4
4
  import type FileEntry from './FileEntry.js';
5
5
  export type Entry = DirectoryEntry | FileEntry | LinkEntry | SymbolicLinkEntry;
6
- export type EntryCallback = (error?: Error, result?: IteratorResult<Entry>) => undefined;
6
+ export type EntryCallback = (error?: Error, result?: IteratorResult<Entry>) => void;
@@ -3,4 +3,4 @@ export { default as FileEntry } from './FileEntry.js';
3
3
  import type { DirectoryEntry, LinkEntry, SymbolicLinkEntry } from 'extract-base-iterator';
4
4
  import type FileEntry from './FileEntry.js';
5
5
  export type Entry = DirectoryEntry | FileEntry | LinkEntry | SymbolicLinkEntry;
6
- export type EntryCallback = (error?: Error, result?: IteratorResult<Entry>) => undefined;
6
+ export type EntryCallback = (error?: Error, result?: IteratorResult<Entry>) => void;
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/tar-iterator/src/types.ts"],"sourcesContent":["export { DirectoryEntry, type ExtractOptions, LinkEntry, Lock, SymbolicLinkEntry } from 'extract-base-iterator';\nexport { default as FileEntry } from './FileEntry.ts';\n\nimport type { DirectoryEntry, LinkEntry, SymbolicLinkEntry } from 'extract-base-iterator';\nimport type FileEntry from './FileEntry.ts';\n\n// Tar-specific Entry union type with tar-specific FileEntry\nexport type Entry = DirectoryEntry | FileEntry | LinkEntry | SymbolicLinkEntry;\n\nexport type EntryCallback = (error?: Error, result?: IteratorResult<Entry>) => undefined;\n"],"names":["DirectoryEntry","FileEntry","LinkEntry","Lock","SymbolicLinkEntry"],"mappings":";;;;;;;;;;;QAASA;eAAAA,mCAAc;;QACHC;eAAAA,oBAAS;;QADiBC;eAAAA,8BAAS;;QAAEC;eAAAA,yBAAI;;QAAEC;eAAAA,sCAAiB;;;mCAAQ;kEACnD"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/tar-iterator/src/types.ts"],"sourcesContent":["export { DirectoryEntry, type ExtractOptions, LinkEntry, Lock, SymbolicLinkEntry } from 'extract-base-iterator';\nexport { default as FileEntry } from './FileEntry.ts';\n\nimport type { DirectoryEntry, LinkEntry, SymbolicLinkEntry } from 'extract-base-iterator';\nimport type FileEntry from './FileEntry.ts';\n\n// Tar-specific Entry union type with tar-specific FileEntry\nexport type Entry = DirectoryEntry | FileEntry | LinkEntry | SymbolicLinkEntry;\n\nexport type EntryCallback = (error?: Error, result?: IteratorResult<Entry>) => void;\n"],"names":["DirectoryEntry","FileEntry","LinkEntry","Lock","SymbolicLinkEntry"],"mappings":";;;;;;;;;;;QAASA;eAAAA,mCAAc;;QACHC;eAAAA,oBAAS;;QADiBC;eAAAA,8BAAS;;QAAEC;eAAAA,yBAAI;;QAAEC;eAAAA,sCAAiB;;;mCAAQ;kEACnD"}
@@ -4,7 +4,9 @@ export default class TarFileEntry extends FileEntry {
4
4
  private lock;
5
5
  private stream;
6
6
  constructor(attributes: FileAttributes, stream: NodeJS.ReadableStream, lock: Lock);
7
- create(dest: string, options: ExtractOptions | NoParamCallback, callback: NoParamCallback): undefined | Promise<boolean>;
8
- _writeFile(fullPath: string, _options: ExtractOptions, callback: NoParamCallback): undefined;
7
+ create(dest: string, callback: NoParamCallback): void;
8
+ create(dest: string, options: ExtractOptions, callback: NoParamCallback): void;
9
+ create(dest: string, options?: ExtractOptions): Promise<boolean>;
10
+ _writeFile(fullPath: string, _options: ExtractOptions, callback: NoParamCallback): void;
9
11
  destroy(): void;
10
12
  }
@@ -46,7 +46,6 @@ let TarFileEntry = class TarFileEntry extends FileEntry {
46
46
  stream.pipe(writeStream);
47
47
  oo(writeStream, [
48
48
  'error',
49
- 'end',
50
49
  'close',
51
50
  'finish'
52
51
  ], cb);
@@ -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 '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, options: ExtractOptions | NoParamCallback, callback: NoParamCallback): undefined | Promise<boolean> {\n if (typeof options === 'function') {\n callback = options;\n options = null;\n }\n if (typeof callback === 'function') {\n options = options || {};\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) => {\n this.create(dest, options, (err?: Error, done?: boolean) => (err ? reject(err) : resolve(done)));\n });\n }\n\n _writeFile(fullPath: string, _options: ExtractOptions, callback: NoParamCallback): undefined {\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', (err: Error) => {\n // Destroy the write stream on source error\n const ws = writeStream as fs.WriteStream & { destroy?: () => void };\n if (typeof ws.destroy === 'function') ws.destroy();\n cb(err);\n });\n\n // Pipe and listen for write stream completion/errors\n stream.pipe(writeStream);\n oo(writeStream, ['error', 'end', '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","ws","destroy","pipe","resume","attributes","retain"],"mappings":"AAAA,OAAOA,UAAU,eAAe;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AAO;gBAChDL,GAAGZ;YACL;YAEA,qDAAqD;YACrDU,OAAOQ,IAAI,CAACL;YACZrB,GAAGqB,aAAa;gBAAC;gBAAS;gBAAO;gBAAS;aAAS,EAAED;QACvD,EAAE,OAAOZ,KAAK;YACZY,GAAGZ;QACL;IACF;IAEAiB,UAAU;QACR5B,UAAUS,SAAS,CAACmB,OAAO,CAAClB,IAAI,CAAC,IAAI;QACrC,IAAI,IAAI,CAACW,MAAM,EAAE;YACf,IAAI,CAACA,MAAM,CAACS,MAAM,IAAI,eAAe;YACrC,IAAI,CAACT,MAAM,GAAG;QAChB;QACA,IAAI,IAAI,CAACT,IAAI,EAAE;YACb,IAAI,CAACA,IAAI,CAACC,OAAO;YACjB,IAAI,CAACD,IAAI,GAAG;QACd;IACF;IAvEA,YAAYmB,UAA0B,EAAEV,MAA6B,EAAET,IAAU,CAAE;QACjF,KAAK,CAACmB;QACN,IAAI,CAACV,MAAM,GAAGA;QACd,IAAI,CAACT,IAAI,GAAGA;QACZ,IAAI,CAACA,IAAI,CAACoB,MAAM;IAClB;AAmEF;AA5EA,SAAqB5B,0BA4EpB"}
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 '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 if (typeof options === 'function') {\n callback = options;\n options = null;\n }\n if (typeof callback === 'function') {\n options = options || {};\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) => {\n this.create(dest, options as ExtractOptions, (err?: Error, done?: boolean) => (err ? reject(err) : resolve(done)));\n });\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', (err: Error) => {\n // Destroy the write stream on source error\n const ws = writeStream as fs.WriteStream & { destroy?: () => void };\n if (typeof ws.destroy === 'function') ws.destroy();\n cb(err);\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","ws","destroy","pipe","resume","attributes","retain"],"mappings":"AAAA,OAAOA,UAAU,eAAe;AAChC,SAA8BC,SAAS,EAAmCC,aAAa,QAAQ,wBAAwB;AACvH,OAAOC,QAAQ,KAAK;AACpB,OAAOC,QAAQ,SAAS;AAIT,IAAA,AAAMC,eAAN,MAAMA,q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OAAOZ,KAAK;YACZY,GAAGZ;QACL;IACF;IAEAiB,UAAU;QACR5B,UAAUS,SAAS,CAACmB,OAAO,CAAClB,IAAI,CAAC,IAAI;QACrC,IAAI,IAAI,CAACW,MAAM,EAAE;YACf,IAAI,CAACA,MAAM,CAACS,MAAM,IAAI,eAAe;YACrC,IAAI,CAACT,MAAM,GAAG;QAChB;QACA,IAAI,IAAI,CAACT,IAAI,EAAE;YACb,IAAI,CAACA,IAAI,CAACC,OAAO;YACjB,IAAI,CAACD,IAAI,GAAG;QACd;IACF;IA1EA,YAAYmB,UAA0B,EAAEV,MAA6B,EAAET,IAAU,CAAE;QACjF,KAAK,CAACmB;QACN,IAAI,CAACV,MAAM,GAAGA;QACd,IAAI,CAACT,IAAI,GAAGA;QACZ,IAAI,CAACA,IAAI,CAACoB,MAAM;IAClB;AAsEF;AA/EA,SAAqB5B,0BA+EpB"}
@@ -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, { Lock } from 'extract-base-iterator';\nimport fs from 'fs';\n\nimport nextEntry from './nextEntry.ts';\nimport TarExtract from './tar/TarExtract.ts';\n\nimport type { Entry, ExtractOptions } from './types.ts';\n\nexport default class TarIterator extends BaseIterator<Entry> {\n /** @internal @hidden */\n lock: Lock | null;\n /** @internal @hidden */\n extract: TarExtract | null;\n\n constructor(source: string | NodeJS.ReadableStream, options: ExtractOptions = {}) {\n super(options);\n this.lock = new Lock();\n this.lock.onDestroy = (err) => BaseIterator.prototype.end.call(this, err);\n\n let cancelled = false;\n const setup = (): undefined => {\n cancelled = true;\n };\n this.processing.push(setup);\n\n // Use our pure TarExtract instead of tar-stream-compat\n // Note: options passed here are ExtractOptions (strip, force, etc.)\n // TarExtract uses TarExtractOptions (filenameEncoding, etc.) which is different\n this.extract = new TarExtract();\n\n const pipe = (cb) => {\n try {\n if (typeof source === 'string') source = fs.createReadStream(source);\n } catch (err) {\n cb(err);\n }\n\n // Register cleanup for source stream\n const stream = source as NodeJS.ReadableStream;\n this.lock.registerCleanup(() => {\n const s = stream as NodeJS.ReadableStream & { destroy?: () => void };\n if (typeof s.destroy === 'function') s.destroy();\n });\n\n const end = once(cb);\n const self = this;\n let firstData = true;\n (source as NodeJS.ReadableStream).on('data', function onData(chunk) {\n try {\n if (self.extract) self.extract.write(chunk);\n if (firstData) {\n firstData = false;\n end();\n }\n } catch (err) {\n // Handle synchronous errors from TarExtract (e.g., invalid format)\n end(err);\n }\n });\n (source as NodeJS.ReadableStream).on('error', end);\n (source as NodeJS.ReadableStream).on('end', function onEnd() {\n if (self.extract) self.extract.end();\n });\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 const lock = this.lock;\n if (lock) {\n this.lock = null; // Clear FIRST to prevent re-entrancy\n lock.err = err;\n lock.release(); // Lock.__destroy() handles BaseIterator.end()\n }\n this.extract = null;\n }\n}\n"],"names":["once","BaseIterator","Lock","fs","nextEntry","TarExtract","TarIterator","end","err","lock","release","extract","source","options","onDestroy","prototype","call","cancelled","setup","processing","push","pipe","cb","createReadStream","stream","registerCleanup","s","destroy","self","firstData","on","onData","chunk","write","onEnd","remove","done","bind"],"mappings":"AAAA,OAAOA,UAAU,eAAe;AAChC,OAAOC,gBAAgBC,IAAI,QAAQ,wBAAwB;AAC3D,OAAOC,QAAQ,KAAK;AAEpB,OAAOC,eAAe,iBAAiB;AACvC,OAAOC,gBAAgB,sBAAsB;AAI9B,IAAA,AAAMC,cAAN,MAAMA,oBAAoBL;IA+DvCM,IAAIC,GAAW,EAAE;QACf,MAAMC,OAAO,IAAI,CAACA,IAAI;QACtB,IAAIA,MAAM;YACR,IAAI,CAACA,IAAI,GAAG,MAAM,qCAAqC;YACvDA,KAAKD,GAAG,GAAGA;YACXC,KAAKC,OAAO,IAAI,8CAA8C;Q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ACAc,KAAK,CAACb;YACJ,IAAI,CAACW,UAAU,CAACgB,MAAM,CAACjB;YACvB,IAAI,IAAI,CAACkB,IAAI,IAAInB,WAAW,QAAQ,OAAO;YAC3CT,MAAM,IAAI,CAACD,GAAG,CAACC,OAAO,IAAI,CAACY,IAAI,CAAChB,UAAUiC,IAAI,CAAC,MAAM;QACvD;IACF;AAWF;AAxEA,SAAqB/B,yBAwEpB"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/tar-iterator/src/TarIterator.ts"],"sourcesContent":["import once from 'call-once-fn';\nimport BaseIterator, { Lock } from 'extract-base-iterator';\nimport fs from 'fs';\n\nimport nextEntry from './nextEntry.ts';\nimport TarExtract from './tar/TarExtract.ts';\n\nimport type { Entry, ExtractOptions } from './types.ts';\n\nexport default class TarIterator extends BaseIterator<Entry> {\n /** @internal @hidden */\n lock: Lock | null;\n /** @internal @hidden */\n extract: TarExtract | null;\n\n constructor(source: string | NodeJS.ReadableStream, options: ExtractOptions = {}) {\n super(options);\n this.lock = new Lock();\n this.lock.onDestroy = (err) => BaseIterator.prototype.end.call(this, err);\n\n let cancelled = false;\n const setup = (): void => {\n cancelled = true;\n };\n this.processing.push(setup);\n\n // Use our pure TarExtract instead of tar-stream-compat\n // Note: options passed here are ExtractOptions (strip, force, etc.)\n // TarExtract uses TarExtractOptions (filenameEncoding, etc.) which is different\n this.extract = new TarExtract();\n\n const pipe = (cb) => {\n try {\n if (typeof source === 'string') source = fs.createReadStream(source);\n } catch (err) {\n cb(err);\n }\n\n // Register cleanup for source stream\n const stream = source as NodeJS.ReadableStream;\n this.lock.registerCleanup(() => {\n const s = stream as NodeJS.ReadableStream & { destroy?: () => void };\n if (typeof s.destroy === 'function') s.destroy();\n });\n\n const end = once(cb);\n const self = this;\n let firstData = true;\n (source as NodeJS.ReadableStream).on('data', function onData(chunk) {\n try {\n if (self.extract) self.extract.write(chunk);\n if (firstData) {\n firstData = false;\n end();\n }\n } catch (err) {\n // Handle synchronous errors from TarExtract (e.g., invalid format)\n end(err);\n }\n });\n (source as NodeJS.ReadableStream).on('error', end);\n (source as NodeJS.ReadableStream).on('end', function onEnd() {\n if (self.extract) self.extract.end();\n });\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 const lock = this.lock;\n if (lock) {\n this.lock = null; // Clear FIRST to prevent re-entrancy\n lock.err = err;\n lock.release(); // Lock.__destroy() handles BaseIterator.end()\n }\n this.extract = null;\n }\n}\n"],"names":["once","BaseIterator","Lock","fs","nextEntry","TarExtract","TarIterator","end","err","lock","release","extract","source","options","onDestroy","prototype","call","cancelled","setup","processing","push","pipe","cb","createReadStream","stream","registerCleanup","s","destroy","self","firstData","on","onData","chunk","write","onEnd","remove","done","bind"],"mappings":"AAAA,OAAOA,UAAU,eAAe;AAChC,OAAOC,gBAAgBC,IAAI,QAAQ,wBAAwB;AAC3D,OAAOC,QAAQ,KAAK;AAEpB,OAAOC,eAAe,iBAAiB;AACvC,OAAOC,gBAAgB,sBAAsB;AAI9B,IAAA,AAAMC,cAAN,MAAMA,oBAAoBL;IA+DvCM,IAAIC,GAAW,EAAE;QACf,MAAMC,OAAO,IAAI,CAACA,IAAI;QACtB,IAAIA,MAAM;YACR,IAAI,CAACA,IAAI,GAAG,MAAM,qCAAqC;YACvDA,KAAKD,GAAG,GAAGA;YACXC,KAAKC,OAAO,IAAI,8CAA8C;QAChE;QACA,IAAI,CAACC,OAAO,GAAG;IACjB;IAjEA,YAAYC,MAAsC,EAAEC,UAA0B,CAAC,CAAC,CAAE;QAChF,KAAK,CAACA;QACN,IAAI,CAACJ,IAAI,GAAG,IAAIP;QAChB,IAAI,CAACO,IAAI,CAACK,SAAS,GAAG,CAACN,MAAQP,aAAac,SAAS,CAACR,GAAG,CAACS,IAAI,CAAC,IAAI,EAAER;QAErE,IAAIS,YAAY;QAChB,MAAMC,QAAQ;YACZD,YAAY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2
  import type { Entry, EntryCallback } from './types.js';
3
- export type TarNext = () => undefined;
4
- export type NextCallback = (error?: Error, entry?: Entry, next?: TarNext) => undefined;
5
- export default function nextEntry(next: TarNext, iterator: Iterator, callback: EntryCallback): undefined;
3
+ export type TarNext = () => void;
4
+ export type NextCallback = (error?: Error, entry?: Entry, next?: TarNext) => void;
5
+ export default function nextEntry(next: TarNext, iterator: Iterator, callback: EntryCallback): void;
@@ -1,8 +1,6 @@
1
1
  import once from 'call-once-fn';
2
2
  import { DirectoryEntry, LinkEntry, normalizePath, SymbolicLinkEntry } from 'extract-base-iterator';
3
3
  import FileEntry from './FileEntry.js';
4
- // setImmediate is preferred (Node 0.10+), falls back to setTimeout for Node 0.8
5
- const defer = typeof setImmediate === 'function' ? setImmediate : (fn)=>setTimeout(fn, 0);
6
4
  export default function nextEntry(next, iterator, callback) {
7
5
  // Guard: bail early if iterator already ended
8
6
  if (!iterator.lock || iterator.isDone()) {
@@ -19,9 +17,8 @@ export default function nextEntry(next, iterator, callback) {
19
17
  extract.removeListener('finish', onEnd);
20
18
  // keep processing
21
19
  if (entry) iterator.push(nextEntry.bind(null, next));
22
- // Use setImmediate to defer the callback invocation
23
- // This ensures proper async behavior with the BaseIterator
24
- defer(()=>{
20
+ // Defer the callback invocation to ensure proper async behavior with the BaseIterator
21
+ setTimeout(()=>{
25
22
  err ? callback(err) : callback(null, entry ? {
26
23
  done: false,
27
24
  value: entry
@@ -29,7 +26,7 @@ export default function nextEntry(next, iterator, callback) {
29
26
  done: true,
30
27
  value: null
31
28
  });
32
- });
29
+ }, 0);
33
30
  });
34
31
  // Use nextCallback for all events to ensure once() wrapper is respected
35
32
  const onError = (err)=>nextCallback(err);
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/tar-iterator/src/nextEntry.ts"],"sourcesContent":["import once from 'call-once-fn';\nimport { DirectoryEntry, LinkEntry, normalizePath, SymbolicLinkEntry } from 'extract-base-iterator';\nimport FileEntry from './FileEntry.ts';\nimport type Iterator from './TarIterator.ts';\n\nimport type { Entry, EntryCallback } from './types.ts';\n\n// setImmediate is preferred (Node 0.10+), falls back to setTimeout for Node 0.8\nconst defer = typeof setImmediate === 'function' ? setImmediate : (fn: () => void) => setTimeout(fn, 0);\n\nexport type TarNext = () => undefined;\nexport type NextCallback = (error?: Error, entry?: Entry, next?: TarNext) => undefined;\n\nexport default function nextEntry(next: TarNext, iterator: Iterator, callback: EntryCallback): undefined {\n // Guard: bail early if iterator already ended\n if (!iterator.lock || iterator.isDone()) {\n return callback(null, { done: true, value: null });\n }\n\n const extract = iterator.extract;\n if (!extract) return callback(new Error('Extract missing'));\n\n const nextCallback = once((err?: Error, entry?: Entry, next?: TarNext) => {\n extract.removeListener('entry', onEntry);\n extract.removeListener('error', onError);\n extract.removeListener('finish', onEnd);\n\n // keep processing\n if (entry) iterator.push(nextEntry.bind(null, next));\n\n // Use setImmediate to defer the callback invocation\n // This ensures proper async behavior with the BaseIterator\n defer(() => {\n err ? callback(err) : callback(null, entry ? { done: false, value: entry } : { done: true, value: null });\n });\n }) as NextCallback;\n\n // Use nextCallback for all events to ensure once() wrapper is respected\n const onError = (err: Error) => nextCallback(err);\n const onEnd = () => nextCallback();\n const onEntry = function onEntry(header, stream, next: TarNext) {\n // Guard: skip if iterator already ended (stale lock)\n if (!iterator.lock || iterator.isDone()) {\n stream.resume(); // drain stream\n return nextCallback(null, null, next);\n }\n\n const attributes = { ...header };\n attributes.path = normalizePath(header.name);\n attributes.mtime = new Date(attributes.mtime);\n\n switch (attributes.type) {\n case 'directory':\n stream.resume(); // drain stream\n return nextCallback(null, new DirectoryEntry(attributes), next);\n case 'symlink':\n stream.resume(); // drain stream\n attributes.linkpath = header.linkname;\n return nextCallback(null, new SymbolicLinkEntry(attributes), next);\n case 'link':\n stream.resume(); // drain stream\n attributes.linkpath = header.linkname;\n return nextCallback(null, new LinkEntry(attributes), next);\n case 'file':\n return nextCallback(null, new FileEntry(attributes, stream, iterator.lock), next);\n }\n\n stream.resume(); // drain stream\n return nextCallback(new Error(`Unrecognized entry type: ${attributes.type}`), null, next);\n };\n\n extract.on('entry', onEntry);\n extract.on('error', onError);\n extract.on('finish', onEnd);\n\n // Resume parsing to emit any pending entry\n // For first call (next is null), this triggers the first entry emission\n // For subsequent calls, next() unlocks the parser which then processes the next header\n if (next) {\n next();\n } else {\n // First call - resume to emit any pending entry\n extract.resume();\n }\n}\n"],"names":["once","DirectoryEntry","LinkEntry","normalizePath","SymbolicLinkEntry","FileEntry","defer","setImmediate","fn","setTimeout","nextEntry","next","iterator","callback","lock","isDone","done","value","extract","Error","nextCallback","err","entry","removeListener","onEntry","onError","onEnd","push","bind","header","stream","resume","attributes","path","name","mtime","Date","type","linkpath","linkname","on"],"mappings":"AAAA,OAAOA,UAAU,eAAe;AAChC,SAASC,cAAc,EAAEC,SAAS,EAAEC,aAAa,EAAEC,iBAAiB,QAAQ,wBAAwB;AACpG,OAAOC,eAAe,iBAAiB;AAKvC,gFAAgF;AAChF,MAAMC,QAAQ,OAAOC,iBAAiB,aAAaA,eAAe,CAACC,KAAmBC,WAAWD,IAAI;AAKrG,eAAe,SAASE,UAAUC,IAAa,EAAEC,QAAkB,EAAEC,QAAuB;IAC1F,8CAA8C;IAC9C,IAAI,CAACD,SAASE,IAAI,IAAIF,SAASG,MAAM,IAAI;QACvC,OAAOF,SAAS,MAAM;YAAEG,MAAM;YAAMC,OAAO;QAAK;IAClD;IAEA,MAAMC,UAAUN,SAASM,OAAO;IAChC,IAAI,CAACA,SAAS,OAAOL,SAAS,IAAIM,MAAM;IAExC,MAAMC,eAAepB,KAAK,CAACqB,KAAaC,OAAeX;QACrDO,QAAQK,cAAc,CAAC,SAASC;QAChCN,QAAQK,cAAc,CAAC,SAASE;QAChCP,QAAQK,cAAc,CAAC,UAAUG;QAEjC,kBAAkB;QAClB,IAAIJ,OAAOV,SAASe,IAAI,CAACjB,UAAUkB,IAAI,CAAC,MAAMjB;QAE9C,oDAAoD;QACpD,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ACtF;IAEAO,QAAQsB,EAAE,CAAC,SAAShB;IACpBN,QAAQsB,EAAE,CAAC,SAASf;IACpBP,QAAQsB,EAAE,CAAC,UAAUd;IAErB,2CAA2C;IAC3C,wEAAwE;IACxE,uFAAuF;IACvF,IAAIf,MAAM;QACRA;IACF,OAAO;QACL,gDAAgD;QAChDO,QAAQa,MAAM;IAChB;AACF"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/tar-iterator/src/nextEntry.ts"],"sourcesContent":["import once from 'call-once-fn';\nimport { DirectoryEntry, LinkEntry, normalizePath, SymbolicLinkEntry } from 'extract-base-iterator';\nimport FileEntry from './FileEntry.ts';\nimport type Iterator from './TarIterator.ts';\n\nimport type { Entry, EntryCallback } from './types.ts';\n\nexport type TarNext = () => void;\nexport type NextCallback = (error?: Error, entry?: Entry, next?: TarNext) => void;\n\nexport default function nextEntry(next: TarNext, iterator: Iterator, callback: EntryCallback): void {\n // Guard: bail early if iterator already ended\n if (!iterator.lock || iterator.isDone()) {\n return callback(null, { done: true, value: null });\n }\n\n const extract = iterator.extract;\n if (!extract) return callback(new Error('Extract missing'));\n\n const nextCallback = once((err?: Error, entry?: Entry, next?: TarNext) => {\n extract.removeListener('entry', onEntry);\n extract.removeListener('error', onError);\n extract.removeListener('finish', onEnd);\n\n // keep processing\n if (entry) iterator.push(nextEntry.bind(null, next));\n\n // Defer the callback invocation to ensure proper async behavior with the BaseIterator\n setTimeout(() => {\n err ? callback(err) : callback(null, entry ? { done: false, value: entry } : { done: true, value: null });\n }, 0);\n }) as NextCallback;\n\n // Use nextCallback for all events to ensure once() wrapper is respected\n const onError = (err: Error) => nextCallback(err);\n const onEnd = () => nextCallback();\n const onEntry = function onEntry(header, stream, next: TarNext) {\n // Guard: skip if iterator already ended (stale lock)\n if (!iterator.lock || iterator.isDone()) {\n stream.resume(); // drain stream\n return nextCallback(null, null, next);\n }\n\n const attributes = { ...header };\n attributes.path = normalizePath(header.name);\n attributes.mtime = new Date(attributes.mtime);\n\n switch (attributes.type) {\n case 'directory':\n stream.resume(); // drain stream\n return nextCallback(null, new DirectoryEntry(attributes), next);\n case 'symlink':\n stream.resume(); // drain stream\n attributes.linkpath = header.linkname;\n return nextCallback(null, new SymbolicLinkEntry(attributes), next);\n case 'link':\n stream.resume(); // drain stream\n attributes.linkpath = header.linkname;\n return nextCallback(null, new LinkEntry(attributes), next);\n case 'file':\n return nextCallback(null, new FileEntry(attributes, stream, iterator.lock), next);\n }\n\n stream.resume(); // drain stream\n return nextCallback(new Error(`Unrecognized entry type: ${attributes.type}`), null, next);\n };\n\n extract.on('entry', onEntry);\n extract.on('error', onError);\n extract.on('finish', onEnd);\n\n // Resume parsing to emit any pending entry\n // For first call (next is null), this triggers the first entry emission\n // For subsequent calls, next() unlocks the parser which then processes the next header\n if (next) {\n next();\n } else {\n // First call - resume to emit any pending entry\n extract.resume();\n }\n}\n"],"names":["once","DirectoryEntry","LinkEntry","normalizePath","SymbolicLinkEntry","FileEntry","nextEntry","next","iterator","callback","lock","isDone","done","value","extract","Error","nextCallback","err","entry","removeListener","onEntry","onError","onEnd","push","bind","setTimeout","header","stream","resume","attributes","path","name","mtime","Date","type","linkpath","linkname","on"],"mappings":"AAAA,OAAOA,UAAU,eAAe;AAChC,SAASC,cAAc,EAAEC,SAAS,EAAEC,aAAa,EAAEC,iBAAiB,QAAQ,wBAAwB;AACpG,OAAOC,eAAe,iBAAiB;AAQvC,eAAe,SAASC,UAAUC,IAAa,EAAEC,QAAkB,EAAEC,QAAuB;IAC1F,8CAA8C;IAC9C,IAAI,CAACD,SAASE,IAAI,IAAIF,SAASG,MAAM,IAAI;QACvC,OAAOF,SAAS,MAAM;YAAEG,MAAM;YAAMC,OAAO;QAAK;IAClD;IAEA,MAAMC,UAAUN,SAASM,OAAO;IAChC,IAAI,CAACA,SAAS,OAAOL,SAAS,IAAIM,MAAM;IAExC,MAAMC,eAAehB,KAAK,CAACiB,KAAaC,OAAeX;QACrDO,QAAQK,cAAc,CAAC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,UAAUwB,YAAYF,QAAQnB,SAASE,IAAI,GAAGH;QAChF;QAEAoB,OAAOC,MAAM,IAAI,eAAe;QAChC,OAAOZ,aAAa,IAAID,MAAM,CAAC,yBAAyB,EAAEc,WAAWK,IAAI,EAAE,GAAG,MAAM3B;IACtF;IAEAO,QAAQuB,EAAE,CAAC,SAASjB;IACpBN,QAAQuB,EAAE,CAAC,SAAShB;IACpBP,QAAQuB,EAAE,CAAC,UAAUf;IAErB,2CAA2C;IAC3C,wEAAwE;IACxE,uFAAuF;IACvF,IAAIf,MAAM;QACRA;IACF,OAAO;QACL,gDAAgD;QAChDO,QAAQc,MAAM;IAChB;AACF"}
@@ -3,4 +3,4 @@ export { default as FileEntry } from './FileEntry.js';
3
3
  import type { DirectoryEntry, LinkEntry, SymbolicLinkEntry } from 'extract-base-iterator';
4
4
  import type FileEntry from './FileEntry.js';
5
5
  export type Entry = DirectoryEntry | FileEntry | LinkEntry | SymbolicLinkEntry;
6
- export type EntryCallback = (error?: Error, result?: IteratorResult<Entry>) => undefined;
6
+ export type EntryCallback = (error?: Error, result?: IteratorResult<Entry>) => void;
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/tar-iterator/src/types.ts"],"sourcesContent":["export { DirectoryEntry, type ExtractOptions, LinkEntry, Lock, SymbolicLinkEntry } from 'extract-base-iterator';\nexport { default as FileEntry } from './FileEntry.ts';\n\nimport type { DirectoryEntry, LinkEntry, SymbolicLinkEntry } from 'extract-base-iterator';\nimport type FileEntry from './FileEntry.ts';\n\n// Tar-specific Entry union type with tar-specific FileEntry\nexport type Entry = DirectoryEntry | FileEntry | LinkEntry | SymbolicLinkEntry;\n\nexport type EntryCallback = (error?: Error, result?: IteratorResult<Entry>) => undefined;\n"],"names":["DirectoryEntry","LinkEntry","Lock","SymbolicLinkEntry","default","FileEntry"],"mappings":"AAAA,SAASA,cAAc,EAAuBC,SAAS,EAAEC,IAAI,EAAEC,iBAAiB,QAAQ,wBAAwB;AAChH,SAASC,WAAWC,SAAS,QAAQ,iBAAiB"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/tar-iterator/src/types.ts"],"sourcesContent":["export { DirectoryEntry, type ExtractOptions, LinkEntry, Lock, SymbolicLinkEntry } from 'extract-base-iterator';\nexport { default as FileEntry } from './FileEntry.ts';\n\nimport type { DirectoryEntry, LinkEntry, SymbolicLinkEntry } from 'extract-base-iterator';\nimport type FileEntry from './FileEntry.ts';\n\n// Tar-specific Entry union type with tar-specific FileEntry\nexport type Entry = DirectoryEntry | FileEntry | LinkEntry | SymbolicLinkEntry;\n\nexport type EntryCallback = (error?: Error, result?: IteratorResult<Entry>) => void;\n"],"names":["DirectoryEntry","LinkEntry","Lock","SymbolicLinkEntry","default","FileEntry"],"mappings":"AAAA,SAASA,cAAc,EAAuBC,SAAS,EAAEC,IAAI,EAAEC,iBAAiB,QAAQ,wBAAwB;AAChH,SAASC,WAAWC,SAAS,QAAQ,iBAAiB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tar-iterator",
3
- "version": "3.2.0",
3
+ "version": "3.3.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",
@@ -62,13 +62,13 @@
62
62
  },
63
63
  "dependencies": {
64
64
  "call-once-fn": "^1.0.1",
65
- "extract-base-iterator": "^2.6.1",
65
+ "extract-base-iterator": "^3.0.0",
66
66
  "on-one": "^1.0.0"
67
67
  },
68
68
  "devDependencies": {
69
69
  "@types/mocha": "*",
70
70
  "@types/node": "*",
71
- "fs-iterator": "^6.1.12",
71
+ "fs-iterator": "^7.0.0",
72
72
  "fs-remove-compat": "^1.0.0",
73
73
  "fs-stats-spys": "^1.0.0",
74
74
  "get-file-compat": "^2.0.0",
@@ -79,7 +79,7 @@
79
79
  "through": "^2.1.0",
80
80
  "ts-dev-stack": "*",
81
81
  "tsds-config": "*",
82
- "unbzip2-stream": "^1.4.3"
82
+ "unbzip2-stream": "1.4.3"
83
83
  },
84
84
  "engines": {
85
85
  "node": ">=0.8"