extract-base-iterator 3.0.0 → 3.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
1
  import type { NoParamCallback } from './types.js';
2
- export default function waitForAccess(fullPath: string, noFollowOrCallback: boolean | NoParamCallback, callbackOrAttempts?: NoParamCallback | number, attempts?: number): void;
2
+ export default function waitForAccess(fullPath: string, noFollowOrCallback: boolean | NoParamCallback, callbackOrAttempts?: NoParamCallback | number, attempts?: number): NodeJS.Timeout;
@@ -1,2 +1,2 @@
1
1
  import type { NoParamCallback } from './types.js';
2
- export default function waitForAccess(fullPath: string, noFollowOrCallback: boolean | NoParamCallback, callbackOrAttempts?: NoParamCallback | number, attempts?: number): void;
2
+ export default function waitForAccess(fullPath: string, noFollowOrCallback: boolean | NoParamCallback, callbackOrAttempts?: NoParamCallback | number, attempts?: number): NodeJS.Timeout;
@@ -32,7 +32,8 @@ function waitForAccess(fullPath, noFollowOrCallback, callbackOrAttempts) {
32
32
  callback = callbackOrAttempts;
33
33
  }
34
34
  // POSIX: finish event is reliable after decompression stream fixes
35
- if (!isWindows) return callback();
35
+ // Use setTimeout(0) to maintain async consistency (avoid Zalgo)
36
+ if (!isWindows) return setTimeout(callback, 0);
36
37
  // Windows: NTFS metadata may not be committed yet, verify accessibility
37
38
  // For symlinks (noFollow=true), use lstat to check the link itself exists
38
39
  // For files/dirs/hardlinks, use open to verify the file is accessible
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/extract-base-iterator/src/waitForAccess.ts"],"sourcesContent":["import fs from 'fs';\n\nimport type { NoParamCallback } from './types.ts';\n\nconst isWindows = process.platform === 'win32' || /^(msys|cygwin)$/.test(process.env.OSTYPE);\n\n// Backward compatible: waitForAccess(path, callback) or waitForAccess(path, noFollow, callback)\nexport default function waitForAccess(fullPath: string, noFollowOrCallback: boolean | NoParamCallback, callbackOrAttempts?: NoParamCallback | number, attempts = 0) {\n // Parse arguments for backward compatibility\n let noFollow: boolean;\n let callback: NoParamCallback;\n if (typeof noFollowOrCallback === 'function') {\n // Old signature: waitForAccess(path, callback, attempts?)\n noFollow = false;\n callback = noFollowOrCallback;\n attempts = (callbackOrAttempts as number) || 0;\n } else {\n // New signature: waitForAccess(path, noFollow, callback, attempts?)\n noFollow = noFollowOrCallback;\n callback = callbackOrAttempts as NoParamCallback;\n }\n\n // POSIX: finish event is reliable after decompression stream fixes\n if (!isWindows) return callback();\n\n // Windows: NTFS metadata may not be committed yet, verify accessibility\n // For symlinks (noFollow=true), use lstat to check the link itself exists\n // For files/dirs/hardlinks, use open to verify the file is accessible\n if (noFollow) {\n fs.lstat(fullPath, (err) => {\n if (err) {\n if (err.code === 'ENOENT' && attempts < 10) {\n const delay = Math.min(5 * 2 ** attempts, 2560);\n return setTimeout(() => waitForAccess(fullPath, noFollow, callback, attempts + 1), delay);\n }\n return callback(err);\n }\n callback();\n });\n } else {\n fs.open(fullPath, 'r', (err, fd) => {\n if (err) {\n if (err.code === 'ENOENT' && attempts < 10) {\n // Exponential backoff: 5, 10, 20, 40, 80, 160, 320, 640, 1280, 2560ms\n // Total max wait: ~5 seconds\n const delay = Math.min(5 * 2 ** attempts, 2560);\n return setTimeout(() => waitForAccess(fullPath, noFollow, callback, attempts + 1), delay);\n }\n return callback(err);\n }\n fs.close(fd, () => callback());\n });\n }\n}\n"],"names":["waitForAccess","isWindows","process","platform","test","env","OSTYPE","fullPath","noFollowOrCallback","callbackOrAttempts","attempts","noFollow","callback","fs","lstat","err","code","delay","Math","min","setTimeout","open","fd","close"],"mappings":";;;;+BAMA,gGAAgG;AAChG;;;eAAwBA;;;yDAPT;;;;;;AAIf,IAAMC,YAAYC,QAAQC,QAAQ,KAAK,WAAW,kBAAkBC,IAAI,CAACF,QAAQG,GAAG,CAACC,MAAM;AAG5E,SAASN,cAAcO,QAAgB,EAAEC,kBAA6C,EAAEC,kBAA6C;QAAEC,WAAAA,iEAAW;IAC/J,6CAA6C;IAC7C,IAAIC;IACJ,IAAIC;IACJ,IAAI,OAAOJ,uBAAuB,YAAY;QAC5C,0DAA0D;QAC1DG,WAAW;QACXC,WAAWJ;QACXE,WAAW,AAACD,sBAAiC;IAC/C,OAAO;QACL,oEAAoE;QACpEE,WAAWH;QACXI,WAAWH;IACb;IAEA,mEAAmE;IACnE,IAAI,CAACR,WAAW,OAAOW;IAEvB,wEAAwE;IACxE,0EAA0E;IAC1E,sEAAsE;IACtE,IAAID,UAAU;QACZE,WAAE,CAACC,KAAK,CAACP,UAAU,SAACQ;YAClB,IAAIA,KAAK;gBACP,IAAIA,IAAIC,IAAI,KAAK,YAAYN,WAAW,IAAI;oBAC1C,IAAMO,QAAQC,KAAKC,GAAG,CAAC,aAAI,GAAKT,WAAU;oBAC1C,OAAOU,WAAW;+BAAMpB,cAAcO,UAAUI,UAAUC,UAAUF,WAAW;uBAAIO;gBACrF;gBACA,OAAOL,SAASG;YAClB;YACAH;QACF;IACF,OAAO;QACLC,WAAE,CAACQ,IAAI,CAACd,UAAU,KAAK,SAACQ,KAAKO;YAC3B,IAAIP,KAAK;gBACP,IAAIA,IAAIC,IAAI,KAAK,YAAYN,WAAW,IAAI;oBAC1C,sEAAsE;oBACtE,6BAA6B;oBAC7B,IAAMO,QAAQC,KAAKC,GAAG,CAAC,aAAI,GAAKT,WAAU;oBAC1C,OAAOU,WAAW;+BAAMpB,cAAcO,UAAUI,UAAUC,UAAUF,WAAW;uBAAIO;gBACrF;gBACA,OAAOL,SAASG;YAClB;YACAF,WAAE,CAACU,KAAK,CAACD,IAAI;uBAAMV;;QACrB;IACF;AACF"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/extract-base-iterator/src/waitForAccess.ts"],"sourcesContent":["import fs from 'fs';\n\nimport type { NoParamCallback } from './types.ts';\n\nconst isWindows = process.platform === 'win32' || /^(msys|cygwin)$/.test(process.env.OSTYPE);\n\n// Backward compatible: waitForAccess(path, callback) or waitForAccess(path, noFollow, callback)\nexport default function waitForAccess(fullPath: string, noFollowOrCallback: boolean | NoParamCallback, callbackOrAttempts?: NoParamCallback | number, attempts = 0) {\n // Parse arguments for backward compatibility\n let noFollow: boolean;\n let callback: NoParamCallback;\n if (typeof noFollowOrCallback === 'function') {\n // Old signature: waitForAccess(path, callback, attempts?)\n noFollow = false;\n callback = noFollowOrCallback;\n attempts = (callbackOrAttempts as number) || 0;\n } else {\n // New signature: waitForAccess(path, noFollow, callback, attempts?)\n noFollow = noFollowOrCallback;\n callback = callbackOrAttempts as NoParamCallback;\n }\n\n // POSIX: finish event is reliable after decompression stream fixes\n // Use setTimeout(0) to maintain async consistency (avoid Zalgo)\n if (!isWindows) return setTimeout(callback, 0);\n\n // Windows: NTFS metadata may not be committed yet, verify accessibility\n // For symlinks (noFollow=true), use lstat to check the link itself exists\n // For files/dirs/hardlinks, use open to verify the file is accessible\n if (noFollow) {\n fs.lstat(fullPath, (err) => {\n if (err) {\n if (err.code === 'ENOENT' && attempts < 10) {\n const delay = Math.min(5 * 2 ** attempts, 2560);\n return setTimeout(() => waitForAccess(fullPath, noFollow, callback, attempts + 1), delay);\n }\n return callback(err);\n }\n callback();\n });\n } else {\n fs.open(fullPath, 'r', (err, fd) => {\n if (err) {\n if (err.code === 'ENOENT' && attempts < 10) {\n // Exponential backoff: 5, 10, 20, 40, 80, 160, 320, 640, 1280, 2560ms\n // Total max wait: ~5 seconds\n const delay = Math.min(5 * 2 ** attempts, 2560);\n return setTimeout(() => waitForAccess(fullPath, noFollow, callback, attempts + 1), delay);\n }\n return callback(err);\n }\n fs.close(fd, () => callback());\n });\n }\n}\n"],"names":["waitForAccess","isWindows","process","platform","test","env","OSTYPE","fullPath","noFollowOrCallback","callbackOrAttempts","attempts","noFollow","callback","setTimeout","fs","lstat","err","code","delay","Math","min","open","fd","close"],"mappings":";;;;+BAMA,gGAAgG;AAChG;;;eAAwBA;;;yDAPT;;;;;;AAIf,IAAMC,YAAYC,QAAQC,QAAQ,KA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function waitForAccess(fullPath: string, noFollowOrCallback: boolean | NoParamCallback, callbackOrAttempts?: NoParamCallback | number, attempts?: number): void;
2
+ export default function waitForAccess(fullPath: string, noFollowOrCallback: boolean | NoParamCallback, callbackOrAttempts?: NoParamCallback | number, attempts?: number): NodeJS.Timeout;
@@ -16,7 +16,8 @@ export default function waitForAccess(fullPath, noFollowOrCallback, callbackOrAt
16
16
  callback = callbackOrAttempts;
17
17
  }
18
18
  // POSIX: finish event is reliable after decompression stream fixes
19
- if (!isWindows) return callback();
19
+ // Use setTimeout(0) to maintain async consistency (avoid Zalgo)
20
+ if (!isWindows) return setTimeout(callback, 0);
20
21
  // Windows: NTFS metadata may not be committed yet, verify accessibility
21
22
  // For symlinks (noFollow=true), use lstat to check the link itself exists
22
23
  // For files/dirs/hardlinks, use open to verify the file is accessible
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/extract-base-iterator/src/waitForAccess.ts"],"sourcesContent":["import fs from 'fs';\n\nimport type { NoParamCallback } from './types.ts';\n\nconst isWindows = process.platform === 'win32' || /^(msys|cygwin)$/.test(process.env.OSTYPE);\n\n// Backward compatible: waitForAccess(path, callback) or waitForAccess(path, noFollow, callback)\nexport default function waitForAccess(fullPath: string, noFollowOrCallback: boolean | NoParamCallback, callbackOrAttempts?: NoParamCallback | number, attempts = 0) {\n // Parse arguments for backward compatibility\n let noFollow: boolean;\n let callback: NoParamCallback;\n if (typeof noFollowOrCallback === 'function') {\n // Old signature: waitForAccess(path, callback, attempts?)\n noFollow = false;\n callback = noFollowOrCallback;\n attempts = (callbackOrAttempts as number) || 0;\n } else {\n // New signature: waitForAccess(path, noFollow, callback, attempts?)\n noFollow = noFollowOrCallback;\n callback = callbackOrAttempts as NoParamCallback;\n }\n\n // POSIX: finish event is reliable after decompression stream fixes\n if (!isWindows) return callback();\n\n // Windows: NTFS metadata may not be committed yet, verify accessibility\n // For symlinks (noFollow=true), use lstat to check the link itself exists\n // For files/dirs/hardlinks, use open to verify the file is accessible\n if (noFollow) {\n fs.lstat(fullPath, (err) => {\n if (err) {\n if (err.code === 'ENOENT' && attempts < 10) {\n const delay = Math.min(5 * 2 ** attempts, 2560);\n return setTimeout(() => waitForAccess(fullPath, noFollow, callback, attempts + 1), delay);\n }\n return callback(err);\n }\n callback();\n });\n } else {\n fs.open(fullPath, 'r', (err, fd) => {\n if (err) {\n if (err.code === 'ENOENT' && attempts < 10) {\n // Exponential backoff: 5, 10, 20, 40, 80, 160, 320, 640, 1280, 2560ms\n // Total max wait: ~5 seconds\n const delay = Math.min(5 * 2 ** attempts, 2560);\n return setTimeout(() => waitForAccess(fullPath, noFollow, callback, attempts + 1), delay);\n }\n return callback(err);\n }\n fs.close(fd, () => callback());\n });\n }\n}\n"],"names":["fs","isWindows","process","platform","test","env","OSTYPE","waitForAccess","fullPath","noFollowOrCallback","callbackOrAttempts","attempts","noFollow","callback","lstat","err","code","delay","Math","min","setTimeout","open","fd","close"],"mappings":"AAAA,OAAOA,QAAQ,KAAK;AAIpB,MAAMC,YAAYC,QAAQC,QAAQ,KAAK,WAAW,kBAAkBC,IAAI,CAACF,QAAQG,GAAG,CAACC,MAAM;AAE3F,gGAAgG;AAChG,eAAe,SAASC,cAAcC,QAAgB,EAAEC,kBAA6C,EAAEC,kBAA6C,EAAEC,WAAW,CAAC;IAChK,6CAA6C;IAC7C,IAAIC;IACJ,IAAIC;IACJ,IAAI,OAAOJ,uBAAuB,YAAY;QAC5C,0DAA0D;QAC1DG,WAAW;QACXC,WAAWJ;QACXE,WAAW,AAACD,sBAAiC;IAC/C,OAAO;QACL,oEAAoE;QACpEE,WAAWH;QACXI,WAAWH;IACb;IAEA,mEAAmE;IACnE,IAAI,CAACT,WAAW,OAAOY;IAEvB,wEAAwE;IACxE,0EAA0E;IAC1E,sEAAsE;IACtE,IAAID,UAAU;QACZZ,GAAGc,KAAK,CAACN,UAAU,CAACO;YAClB,IAAIA,KAAK;gBACP,IAAIA,IAAIC,IAAI,KAAK,YAAYL,WAAW,IAAI;oBAC1C,MAAMM,QAAQC,KAAKC,GAAG,CAAC,IAAI,KAAKR,UAAU;oBAC1C,OAAOS,WAAW,IAAMb,cAAcC,UAAUI,UAAUC,UAAUF,WAAW,IAAIM;gBACrF;gBACA,OAAOJ,SAASE;YAClB;YACAF;QACF;IACF,OAAO;QACLb,GAAGqB,IAAI,CAACb,UAAU,KAAK,CAACO,KAAKO;YAC3B,IAAIP,KAAK;gBACP,IAAIA,IAAIC,IAAI,KAAK,YAAYL,WAAW,IAAI;oBAC1C,sEAAsE;oBACtE,6BAA6B;oBAC7B,MAAMM,QAAQC,KAAKC,GAAG,CAAC,IAAI,KAAKR,UAAU;oBAC1C,OAAOS,WAAW,IAAMb,cAAcC,UAAUI,UAAUC,UAAUF,WAAW,IAAIM;gBACrF;gBACA,OAAOJ,SAASE;YAClB;YACAf,GAAGuB,KAAK,CAACD,IAAI,IAAMT;QACrB;IACF;AACF"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/iterators/extract-base-iterator/src/waitForAccess.ts"],"sourcesContent":["import fs from 'fs';\n\nimport type { NoParamCallback } from './types.ts';\n\nconst isWindows = process.platform === 'win32' || /^(msys|cygwin)$/.test(process.env.OSTYPE);\n\n// Backward compatible: waitForAccess(path, callback) or waitForAccess(path, noFollow, callback)\nexport default function waitForAccess(fullPath: string, noFollowOrCallback: boolean | NoParamCallback, callbackOrAttempts?: NoParamCallback | number, attempts = 0) {\n // Parse arguments for backward compatibility\n let noFollow: boolean;\n let callback: NoParamCallback;\n if (typeof noFollowOrCallback === 'function') {\n // Old signature: waitForAccess(path, callback, attempts?)\n noFollow = false;\n callback = noFollowOrCallback;\n attempts = (callbackOrAttempts as number) || 0;\n } else {\n // New signature: waitForAccess(path, noFollow, callback, attempts?)\n noFollow = noFollowOrCallback;\n callback = callbackOrAttempts as NoParamCallback;\n }\n\n // POSIX: finish event is reliable after decompression stream fixes\n // Use setTimeout(0) to maintain async consistency (avoid Zalgo)\n if (!isWindows) return setTimeout(callback, 0);\n\n // Windows: NTFS metadata may not be committed yet, verify accessibility\n // For symlinks (noFollow=true), use lstat to check the link itself exists\n // For files/dirs/hardlinks, use open to verify the file is accessible\n if (noFollow) {\n fs.lstat(fullPath, (err) => {\n if (err) {\n if (err.code === 'ENOENT' && attempts < 10) {\n const delay = Math.min(5 * 2 ** attempts, 2560);\n return setTimeout(() => waitForAccess(fullPath, noFollow, callback, attempts + 1), delay);\n }\n return callback(err);\n }\n callback();\n });\n } else {\n fs.open(fullPath, 'r', (err, fd) => {\n if (err) {\n if (err.code === 'ENOENT' && attempts < 10) {\n // Exponential backoff: 5, 10, 20, 40, 80, 160, 320, 640, 1280, 2560ms\n // Total max wait: ~5 seconds\n const delay = Math.min(5 * 2 ** attempts, 2560);\n return setTimeout(() => waitForAccess(fullPath, noFollow, callback, attempts + 1), delay);\n }\n return callback(err);\n }\n fs.close(fd, () => callback());\n });\n }\n}\n"],"names":["fs","isWindows","process","platform","test","env","OSTYPE","waitForAccess","fullPath","noFollowOrCallback","callbackOrAttempts","attempts","noFollow","callback","setTimeout","lstat","err","code","delay","Math","min","open","fd","close"],"mappings":"AAAA,OAAOA,QAAQ,KAAK;AAIpB,MAAMC,YAAYC,QAAQC,QAAQ,KAAK,WAAW,kBAAkBC,IAAI,CAACF,QAAQG,GAAG,CAACC,MAAM;AAE3F,gGAAgG;AAChG,eAAe,SAASC,cAAcC,QAAgB,EAAEC,kBAA6C,EAAEC,kBAA6C,EAAEC,WAAW,CAAC;IAChK,6CAA6C;IAC7C,IAAIC;IACJ,IAAIC;IACJ,IAAI,OAAOJ,uBAAuB,YAAY;QAC5C,0DAA0D;QAC1DG,WAAW;QACXC,WAAWJ;QACXE,WAAW,AAACD,sBAAiC;IAC/C,OAAO;QACL,oEAAoE;QACpEE,WAAWH;QACXI,WAAWH;IACb;IAEA,mEAAmE;IACnE,gEAAgE;IAChE,IAAI,CAACT,WAAW,OAAOa,WAAWD,UAAU;IAE5C,wEAAwE;IACxE,0EAA0E;IAC1E,sEAAsE;IACtE,IAAID,UAAU;QACZZ,GAAGe,KAAK,CAACP,UAAU,CAACQ;YAClB,IAAIA,KAAK;gBACP,IAAIA,IAAIC,IAAI,KAAK,YAAYN,WAAW,IAAI;oBAC1C,MAAMO,QAAQC,KAAKC,GAAG,CAAC,IAAI,KAAKT,UAAU;oBAC1C,OAAOG,WAAW,IAAMP,cAAcC,UAAUI,UAAUC,UAAUF,WAAW,IAAIO;gBACrF;gBACA,OAAOL,SAASG;YAClB;YACAH;QACF;IACF,OAAO;QACLb,GAAGqB,IAAI,CAACb,UAAU,KAAK,CAACQ,KAAKM;YAC3B,IAAIN,KAAK;gBACP,IAAIA,IAAIC,IAAI,KAAK,YAAYN,WAAW,IAAI;oBAC1C,sEAAsE;oBACtE,6BAA6B;oBAC7B,MAAMO,QAAQC,KAAKC,GAAG,CAAC,IAAI,KAAKT,UAAU;oBAC1C,OAAOG,WAAW,IAAMP,cAAcC,UAAUI,UAAUC,UAAUF,WAAW,IAAIO;gBACrF;gBACA,OAAOL,SAASG;YAClB;YACAhB,GAAGuB,KAAK,CAACD,IAAI,IAAMT;QACrB;IACF;AACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "extract-base-iterator",
3
- "version": "3.0.0",
3
+ "version": "3.0.1",
4
4
  "description": "Base iterator for extract iterators like tar-iterator and zip-iterator",
5
5
  "keywords": [
6
6
  "extract",