tar 8.0.0 → 8.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.
- package/README.md +8 -1
- package/dist/commonjs/index.min.js +2 -2
- package/dist/commonjs/index.min.js.map +3 -3
- package/dist/commonjs/server/index.min.js +2 -2
- package/dist/commonjs/server/index.min.js.map +3 -3
- package/dist/commonjs/unpack.d.ts +8 -0
- package/dist/commonjs/unpack.d.ts.map +1 -1
- package/dist/commonjs/unpack.js +38 -14
- package/dist/commonjs/unpack.js.map +1 -1
- package/dist/esm/index.min.js +2 -2
- package/dist/esm/index.min.js.map +3 -3
- package/dist/esm/server/index.min.js +2 -2
- package/dist/esm/server/index.min.js.map +3 -3
- package/dist/esm/unpack.d.ts +8 -0
- package/dist/esm/unpack.d.ts.map +1 -1
- package/dist/esm/unpack.js +38 -14
- package/dist/esm/unpack.js.map +1 -1
- package/package.json +1 -1
|
@@ -113,6 +113,14 @@ export declare class UnpackBase<E extends EntryData, O extends UnpackBaseOptions
|
|
|
113
113
|
* target of a link entry. None of them can be a symbolic link.
|
|
114
114
|
*/
|
|
115
115
|
linkParts(entry: E, absolute: string): string[];
|
|
116
|
+
/**
|
|
117
|
+
* The parts of the path from the extraction directory to the
|
|
118
|
+
* parent directory of an entry. The extraction checks them again
|
|
119
|
+
* after it makes the entry: none of them can be a symbolic link
|
|
120
|
+
* then. So a directory that another process replaced with a
|
|
121
|
+
* symbolic link during the extraction is an error of the entry.
|
|
122
|
+
*/
|
|
123
|
+
parentParts(absolute: string): string[];
|
|
116
124
|
/** The error for a link target that goes through a symbolic link. */
|
|
117
125
|
symlinkError(symlink: string, parts: string[]): SymlinkError;
|
|
118
126
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unpack.d.ts","sourceRoot":"","sources":["../../src/unpack.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAIjD,OAAO,KAAK,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SAAS,CAAC,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE;IAU/C;;;;;;OAMG;IACH,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE;IAMvC,qEAAqE;IACrE,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,YAAY;CAM7D;AAYD;;;;;;;GAOG;AACH,qBAAa,MAAO,SAAQ,UAAU,CAAC,SAAS,EAAE,cAAc,CAAC;;gBAUnD,GAAG,EAAE,cAAc;IAO/B;;;;OAIG;IACG,OAAO,CAAC,KAAK,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;CAwT9C;AAED;;;GAGG;AACH,qBAAa,UAAW,SAAQ,UAAU,CACxC,aAAa,EACb,kBAAkB,CACnB;;gBAIa,GAAG,EAAE,kBAAkB;IAKnC,iEAAiE;IACjE,OAAO,CAAC,KAAK,EAAE,YAAY,GAAG,IAAI;CAwLnC"}
|
package/dist/commonjs/unpack.js
CHANGED
|
@@ -429,6 +429,18 @@ class UnpackBase {
|
|
|
429
429
|
linkpath.split('/')
|
|
430
430
|
: (0, path_js_1.relative)(this.cwd, this.resolve(this.dirname(absolute), linkpath)).split('/');
|
|
431
431
|
}
|
|
432
|
+
/**
|
|
433
|
+
* The parts of the path from the extraction directory to the
|
|
434
|
+
* parent directory of an entry. The extraction checks them again
|
|
435
|
+
* after it makes the entry: none of them can be a symbolic link
|
|
436
|
+
* then. So a directory that another process replaced with a
|
|
437
|
+
* symbolic link during the extraction is an error of the entry.
|
|
438
|
+
*/
|
|
439
|
+
parentParts(absolute) {
|
|
440
|
+
const { cwd } = this;
|
|
441
|
+
const parent = absolute === cwd ? cwd : this.dirname(absolute);
|
|
442
|
+
return parent === cwd ? [] : (0, path_js_1.relative)(cwd, parent).split('/');
|
|
443
|
+
}
|
|
432
444
|
/** The error for a link target that goes through a symbolic link. */
|
|
433
445
|
symlinkError(symlink, parts) {
|
|
434
446
|
return new symlink_error_js_1.SymlinkError(symlink, this.resolve(this.cwd, parts.join('/')));
|
|
@@ -601,15 +613,18 @@ class Unpack extends UnpackBase {
|
|
|
601
613
|
return this.#file(entry, absolute, body, reader);
|
|
602
614
|
}
|
|
603
615
|
if (dirTypes.has(entry.type))
|
|
604
|
-
|
|
605
|
-
await this.#ensureNoSymlink(this.linkParts(entry, absolute));
|
|
606
|
-
const linkpath = String(entry.linkpath);
|
|
607
|
-
if (entry.type === 'Link') {
|
|
608
|
-
await fs.link(this.resolve(cwd, linkpath), absolute);
|
|
609
|
-
}
|
|
616
|
+
await this.#directory(entry, absolute);
|
|
610
617
|
else {
|
|
611
|
-
await
|
|
618
|
+
await this.#ensureNoSymlink(this.linkParts(entry, absolute));
|
|
619
|
+
const linkpath = String(entry.linkpath);
|
|
620
|
+
if (entry.type === 'Link') {
|
|
621
|
+
await fs.link(this.resolve(cwd, linkpath), absolute);
|
|
622
|
+
}
|
|
623
|
+
else {
|
|
624
|
+
await fs.symlink(linkpath, absolute);
|
|
625
|
+
}
|
|
612
626
|
}
|
|
627
|
+
await this.#ensureNoSymlink(this.parentParts(absolute));
|
|
613
628
|
}
|
|
614
629
|
async #unlink(path) {
|
|
615
630
|
const fs = this.#fs;
|
|
@@ -650,6 +665,9 @@ class Unpack extends UnpackBase {
|
|
|
650
665
|
const fs = this.#fs;
|
|
651
666
|
const handle = await fs.open(absolute, this.writeFlag(entry.size), entry.mode ?? this.fmode);
|
|
652
667
|
try {
|
|
668
|
+
// The file is open. Write to it only if no parent directory
|
|
669
|
+
// became a symbolic link before the open.
|
|
670
|
+
await this.#ensureNoSymlink(this.parentParts(absolute));
|
|
653
671
|
if (reader)
|
|
654
672
|
await this.#pipe(entry, body, reader, handle);
|
|
655
673
|
else
|
|
@@ -843,15 +861,18 @@ class UnpackSync extends UnpackBase {
|
|
|
843
861
|
return this.#file(entry, absolute, reader);
|
|
844
862
|
}
|
|
845
863
|
if (dirTypes.has(entry.type))
|
|
846
|
-
|
|
847
|
-
this.#ensureNoSymlink(this.linkParts(entry, absolute));
|
|
848
|
-
const linkpath = String(entry.linkpath);
|
|
849
|
-
if (entry.type === 'Link') {
|
|
850
|
-
fs.linkSync(this.resolve(cwd, linkpath), absolute);
|
|
851
|
-
}
|
|
864
|
+
this.#directory(entry, absolute);
|
|
852
865
|
else {
|
|
853
|
-
|
|
866
|
+
this.#ensureNoSymlink(this.linkParts(entry, absolute));
|
|
867
|
+
const linkpath = String(entry.linkpath);
|
|
868
|
+
if (entry.type === 'Link') {
|
|
869
|
+
fs.linkSync(this.resolve(cwd, linkpath), absolute);
|
|
870
|
+
}
|
|
871
|
+
else {
|
|
872
|
+
fs.symlinkSync(linkpath, absolute);
|
|
873
|
+
}
|
|
854
874
|
}
|
|
875
|
+
this.#ensureNoSymlink(this.parentParts(absolute));
|
|
855
876
|
}
|
|
856
877
|
#unlink(path) {
|
|
857
878
|
const fs = this.#fs;
|
|
@@ -902,6 +923,9 @@ class UnpackSync extends UnpackBase {
|
|
|
902
923
|
const fs = this.#fs;
|
|
903
924
|
const fd = fs.openSync(absolute, this.writeFlag(entry.size), entry.mode ?? this.fmode);
|
|
904
925
|
try {
|
|
926
|
+
// The file is open. Write to it only if no parent directory
|
|
927
|
+
// became a symbolic link before the open.
|
|
928
|
+
this.#ensureNoSymlink(this.parentParts(absolute));
|
|
905
929
|
const tx = this.opt.transform?.(entry);
|
|
906
930
|
for (;;) {
|
|
907
931
|
let part;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unpack.js","sourceRoot":"","sources":["../../src/unpack.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yDAAiD;AAEjD,kDAAmC;AACnC,6CAAuD;AAEvD,yCAAgE;AAChE,6CASqB;AACrB,iEAAyD;AACzD,uCAOkB;AAElB,qEAA4D;AAC5D,uCAA+C;AAC/C,mDAKwB;AACxB,mDAAgE;AAEhE,MAAM,iBAAi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AAQ,EAAE,GAAG,EAAE,GAAG,CAAC,CAAA;oBAClC,CAAC;oBAAC,MAAM,CAAC;wBACP,MAAM,EAAE,CAAA;oBACV,CAAC;gBACH,CAAC;YACH,CAAC;QACH,CAAC;QAAC,OAAO,EAAE,EAAE,CAAC;YACZ,gEAAgE;YAChE,sDAAsD;YACtD,IAAI,CAAC;gBACH,EAAE,CAAC,SAAS,CAAC,EAAE,CAAC,CAAA;YAClB,CAAC;YAAC,MAAM,CAAC,CAAA,CAAC;YACV,MAAM,EAAE,CAAA;QACV,CAAC;QACD,EAAE,CAAC,SAAS,CAAC,EAAE,CAAC,CAAA;IAClB,CAAC;CACF;AA/LD,gCA+LC","sourcesContent":["import { SymlinkError } from './symlink-error.js'\nimport type { EntryTypeName } from './types.js'\nimport * as wc from './winchars.js'\nimport { TarReader, TarReaderSync } from './entries.js'\nimport type { ExtractFS, ExtractFSSync, ExtractStats } from './fs.js'\nimport { mkdir, mkdirSync, type MkdirOptions } from './mkdir.js'\nimport {\n countOption,\n ownOptions,\n type ExtractOptions,\n type ExtractOptionsSync,\n type ReadOptions,\n type TarInput,\n type TarInputSync,\n type UnpackOptions,\n} from './options.js'\nimport { PathReservations } from './path-reservations.js'\nimport {\n dirname,\n isAbsolute,\n join,\n normalize,\n relative,\n resolve,\n} from './path.js'\nimport type { EntryData, ReadEntry, ReadEntrySync } from './read-entry.js'\nimport { stripAbsolutePath } from './strip-absolute-path.js'\nimport { warn, type WarnData } from './warn.js'\nimport {\n win32Dirname,\n win32IsAbsolute,\n win32Resolve,\n win32Root,\n} from './win32-path.js'\nimport { writeFlags, type OpenConstants } from './write-flag.js'\n\nconst DEFAULT_MAX_DEPTH = 1024\n// Longer than any path that a supported platform can create.\nconst MAX_PATH_LENGTH = 32768\nconst DEFAULT_JOBS = 16\n\nconst fileTypes = new Set<EntryTypeName>([\n 'File',\n 'OldFile',\n 'ContiguousFile',\n])\nconst dirTypes = new Set<EntryTypeName>(['Directory', 'GNUDumpDir'])\nconst linkTypes = new Set<EntryTypeName>(['Link', 'SymbolicLink'])\n\n// The first of the values that is an unsigned 32-bit integer, or the\n// last value.\nconst uint32 = (\n a: number | undefined,\n b: number | undefined,\n c: number | undefined,\n) =>\n a !== undefined ? a\n : b !== undefined && b === b >>> 0 ? b\n : c\n\n/** The options that `UnpackBase` reads. */\nexport type UnpackBaseOptions<E extends EntryData> = ReadOptions<E> &\n UnpackOptions & { fs: { constants?: OpenConstants } }\n\n/**\n * The parts of the extraction that do not use the file system: the\n * options, the checks of each entry, and the warnings. `Unpack` and\n * `UnpackSync` add the file system work.\n */\nexport class UnpackBase<\n E extends EntryData,\n O extends UnpackBaseOptions<E> = UnpackBaseOptions<E>,\n> {\n /** The options, with no prototype. */\n opt: O\n /** The absolute path of the extraction directory. */\n cwd: string\n win32: boolean\n strip: number\n maxDepth: number\n preservePaths: boolean\n unlink: boolean\n keep: boolean\n newer: boolean\n noMtime: boolean\n chmod: boolean\n uid?: number\n gid?: number\n preserveOwner: boolean\n forceChown: boolean\n processUid?: number\n processGid?: number\n processUmask: number\n umask: number\n dmode: number\n fmode: number\n /** Gives the `open` flag for a new file of a given size. */\n writeFlag: (size: number) => string | number\n /** Resolve a path from an absolute path. */\n resolve: (base: string, path: string) => string\n /** The parent directory of an absolute path. */\n dirname: (path: string) => string\n /** Set when an error stops the extraction. */\n fatal?: { error: unknown }\n\n constructor(options: O) {\n const opt = (this.opt = ownOptions(options))\n const win32 = (this.win32 = opt.platform === 'win32')\n this.resolve = win32 ? win32Resolve : resolve\n this.dirname = win32 ? win32Dirname : dirname\n\n if (typeof opt.cwd !== 'string') {\n throw new TypeError('cwd is required')\n }\n const cwd = win32 ? opt.cwd.replaceAll('\\\\', '/') : opt.cwd\n if (!(win32 ? win32IsAbsolute : isAbsolute)(cwd)) {\n throw new TypeError('cwd must be an absolute path')\n }\n this.cwd = this.resolve(cwd, '')\n\n if (typeof opt.uid === 'number' || typeof opt.gid === 'number') {\n // need both or neither\n if (typeof opt.uid !== 'number' || typeof opt.gid !== 'number') {\n throw new TypeError('cannot set owner without number uid and gid')\n }\n // A value that is not valid must not fall back to the owner\n // in the archive.\n if (opt.uid !== opt.uid >>> 0 || opt.gid !== opt.gid >>> 0) {\n throw new TypeError('uid and gid must be unsigned 32-bit integers')\n }\n if (opt.preserveOwner) {\n throw new TypeError(\n 'cannot preserve owner in archive and also set owner explicitly',\n )\n }\n this.uid = opt.uid\n this.gid = opt.gid\n }\n this.processUid = opt.processUid\n this.processGid = opt.processGid\n this.preserveOwner =\n opt.preserveOwner === undefined && typeof opt.uid !== 'number' ?\n opt.processUid === 0\n : !!opt.preserveOwner\n this.forceChown = opt.forceChown === true\n\n this.maxDepth =\n typeof opt.maxDepth === 'number' ? opt.maxDepth : DEFAULT_MAX_DEPTH\n this.strip = Number(opt.strip) || 0\n this.preservePaths = !!opt.preservePaths\n this.unlink = !!opt.unlink\n this.keep = !!opt.keep\n this.newer = !!opt.newer\n this.noMtime = !!opt.noMtime\n this.chmod = !!opt.chmod\n\n // Without chmod, the umask of the process is not needed.\n this.processUmask =\n !this.chmod ? 0\n : typeof opt.processUmask === 'number' ? opt.processUmask\n : 0o22\n this.umask =\n typeof opt.umask === 'number' ? opt.umask : this.processUmask\n this.dmode = opt.dmode || 0o777 & ~this.umask\n this.fmode = opt.fmode || 0o666 & ~this.umask\n\n this.writeFlag = writeFlags(opt.fs.constants, win32)\n }\n\n /**\n * Report a problem to `onwarn`, or throw it if `strict` is set. A\n * damaged archive is always an error here, because the extraction\n * cannot be complete.\n */\n warn(code: string, message: string | Error, data: WarnData = {}): void {\n if (code === 'TAR_BAD_ARCHIVE' || code === 'TAR_ABORT') {\n data.recoverable = false\n }\n data.cwd = this.cwd\n warn(this.opt, code, message, data)\n }\n\n /** The options for the reader. Its warnings go to `warn()`. */\n readerOptions(): ReadOptions<E> {\n return ownOptions<ReadOptions<E>>(this.opt, {\n strict: false,\n onwarn: (code, message, data) =>\n data instanceof Error ?\n this.warn(code, data)\n : this.warn(code, message, data),\n })\n }\n\n /**\n * Report the failure of one entry as a `TAR_ENTRY_ERROR` warning.\n * Throws the error if it stops the extraction: the extraction\n * directory is not usable, the archive cannot be read, or `strict`\n * is set.\n */\n entryError(er: unknown, entry: E): void {\n if (this.fatal?.error === er || (er as Error)?.name === 'CwdError') {\n throw er\n }\n this.warn('TAR_ENTRY_ERROR', er as Error, { entry })\n }\n\n /** Record the error that stops the extraction. Returns it. */\n fail(error: unknown): unknown {\n this.fatal ??= { error }\n return error\n }\n\n // Remove the root of an absolute path, and refuse a path that can\n // leave the extraction directory. False if the entry is refused.\n #stripAbsolutePath(entry: E, field: 'path' | 'linkpath'): boolean {\n const p = entry[field]\n if (!p || this.preservePaths) return true\n\n const [root, stripped] = stripAbsolutePath(p)\n const parts = stripped.replaceAll('\\\\', '/').split('/')\n\n if (parts.includes('..')) {\n // A path, and the target of a hard link, cannot have '..' at\n // all. The target of a symbolic link is relative to the\n // directory of the link, so '../sibling/file' can be valid.\n if (field === 'path' || entry.type === 'Link') {\n this.warn('TAR_ENTRY_ERROR', `${field} contains '..'`, {\n entry,\n [field]: p,\n })\n return false\n }\n // A '..' is only safe at the start of the target. Any named\n // part before it can be a symlink, and then the '..' goes to\n // the parent of the target of that symlink.\n const firstName = parts.findIndex(\n part => part !== '..' && part !== '.' && part !== '',\n )\n if (firstName !== -1 && parts.includes('..', firstName)) {\n this.warn(\n 'TAR_ENTRY_ERROR',\n `${field} contains '..' after a path portion`,\n { entry, [field]: p },\n )\n return false\n }\n // Normalize the path, so that the directory is the one where\n // the link is created. The path 'x/.' creates the link 'x'.\n const entryDir = dirname(normalize(entry.path))\n const resolved = normalize(join(entryDir, parts.join('/')))\n if (resolved.startsWith('../') || resolved === '..') {\n this.warn(\n 'TAR_ENTRY_ERROR',\n `${field} escapes extraction directory`,\n { entry, [field]: p },\n )\n return false\n }\n }\n\n if (root) {\n ;(entry as EntryData)[field] = stripped\n this.warn(\n 'TAR_ENTRY_INFO',\n `stripping ${root} from absolute ${field}`,\n { entry, [field]: p },\n )\n }\n return true\n }\n\n /**\n * Check the entry, with no use of the file system. Set its\n * `absolute` path, and change its `path`, `linkpath`, and `mode` to\n * the values to extract. False if the entry must not be extracted.\n */\n check(entry: E): boolean {\n const p = entry.path\n const parts = p.split('/')\n\n if (this.strip) {\n if (parts.length < this.strip) return false\n if (entry.type === 'Link') {\n const linkparts = String(entry.linkpath).split('/')\n if (linkparts.length < this.strip) return false\n entry.linkpath = linkparts.slice(this.strip).join('/')\n }\n parts.splice(0, this.strip)\n // No part of the path is left, as for the top directory of a\n // package. The entry must not change the extraction directory.\n if (parts.every(part => part === '')) return false\n entry.path = parts.join('/')\n }\n\n const { maxDepth } = this\n if (isFinite(maxDepth) && parts.length > maxDepth) {\n this.warn('TAR_ENTRY_ERROR', 'path excessively deep', {\n entry,\n path: p,\n depth: parts.length,\n maxDepth,\n })\n return false\n }\n // The path reservations do work for each parent directory of the\n // path and of the linkpath.\n const { linkpath } = entry\n if (\n linkpath &&\n isFinite(maxDepth) &&\n linkpath.split('/').length > maxDepth\n ) {\n this.warn('TAR_ENTRY_ERROR', 'linkpath excessively deep', {\n entry,\n path: p,\n linkpath,\n maxDepth,\n })\n return false\n }\n for (const field of ['path', 'linkpath'] as const) {\n const { length } = entry[field] ?? ''\n if (length > MAX_PATH_LENGTH) {\n this.warn('TAR_ENTRY_ERROR', `${field} excessively long`, {\n entry,\n path: p,\n length,\n maxLength: MAX_PATH_LENGTH,\n })\n return false\n }\n }\n\n if (\n !this.#stripAbsolutePath(entry, 'path') ||\n !this.#stripAbsolutePath(entry, 'linkpath')\n ) {\n return false\n }\n\n const { cwd } = this\n let absolute = this.resolve(cwd, entry.path)\n\n // The checks above refuse a path that leaves the extraction\n // directory. This check is defense in depth.\n if (\n !this.preservePaths &&\n absolute !== cwd &&\n // A root, such as `/` or `c:/`, ends with a slash.\n !absolute.startsWith(cwd.endsWith('/') ? cwd : cwd + '/')\n ) {\n this.warn('TAR_ENTRY_ERROR', 'path escaped extraction target', {\n entry,\n path: entry.path,\n resolvedPath: absolute,\n cwd,\n })\n return false\n }\n\n // An archive can set properties of the extraction directory, but\n // it cannot replace it with a different kind of thing.\n if (absolute === cwd && !dirTypes.has(entry.type)) return false\n\n // Do not change the ':' of a drive letter.\n if (this.win32) {\n const aRoot = win32Root(absolute)\n absolute = aRoot + wc.encode(absolute.slice(aRoot.length))\n const pRoot = win32Root(entry.path)\n entry.path = pRoot + wc.encode(entry.path.slice(pRoot.length))\n }\n entry.absolute = absolute\n\n // Never set the setuid, setgid, or sticky bit from an archive.\n if (typeof entry.mode === 'number') entry.mode &= 0o777\n\n if (dirTypes.has(entry.type)) {\n if (entry.mode) entry.mode |= 0o700\n } else if (!fileTypes.has(entry.type) && !linkTypes.has(entry.type)) {\n // A device or a FIFO is never made.\n entry.unsupported = true\n this.warn(\n 'TAR_ENTRY_UNSUPPORTED',\n `unsupported entry type: ${entry.type}`,\n { entry },\n )\n return false\n }\n return true\n }\n\n /**\n * The paths that the entry must have for itself while it is made.\n * A link also reserves its target, so that an entry that makes the\n * target, and an entry that goes through the link, do not run at\n * the same time as the link.\n */\n reservedPaths(entry: E): string[] {\n const { path, linkpath } = entry\n if (!linkpath) return [path]\n // The target of a symlink is relative to the directory of the\n // link. The target of a hard link is relative to the cwd.\n return [\n path,\n entry.type === 'SymbolicLink' && !isAbsolute(linkpath) ?\n join(dirname(path), linkpath)\n : linkpath,\n ]\n }\n\n /** The options to make a directory with a mode. */\n mkdirOptions(mode: number): MkdirOptions {\n return {\n uid: this.uid,\n gid: this.gid,\n processUid: this.processUid,\n processGid: this.processGid,\n umask: this.processUmask,\n preserve: this.preservePaths,\n unlink: this.unlink,\n cwd: this.cwd,\n mode,\n }\n }\n\n /**\n * The owner to set on the entry, if it needs one: with\n * `preserveOwner`, when the owner in the archive is not the process\n * owner, and with `uid` and `gid`, when they are not the process\n * owner.\n */\n owner(entry: E): { uid: number; gid: number } | undefined {\n const doChown =\n this.forceChown ||\n (this.preserveOwner &&\n ((typeof entry.uid === 'number' &&\n entry.uid !== this.processUid) ||\n (typeof entry.gid === 'number' &&\n entry.gid !== this.processGid))) ||\n (typeof this.uid === 'number' && this.uid !== this.processUid) ||\n (typeof this.gid === 'number' && this.gid !== this.processGid)\n const uid = uint32(this.uid, entry.uid, this.processUid)\n const gid = uint32(this.gid, entry.gid, this.processGid)\n return doChown && typeof uid === 'number' && typeof gid === 'number' ?\n { uid, gid }\n : undefined\n }\n\n /** The times to set on the entry, if it needs them. */\n times(entry: E): { atime: Date; mtime: Date } | undefined {\n return entry.mtime && !this.noMtime ?\n { atime: entry.atime || new Date(), mtime: entry.mtime }\n : undefined\n }\n\n /** True if the object on disk at the path of the entry must stay. */\n skip(entry: E, st: ExtractStats): boolean {\n return (\n this.keep || (this.newer && st.mtime > (entry.mtime ?? st.mtime))\n )\n }\n\n /**\n * True if the entry can be written into the file that is on disk.\n * A file with more than one link is not used, because the write\n * would change the other links. Windows does not report a useful\n * link count.\n */\n isReusable(entry: E, st: ExtractStats): boolean {\n return (\n entry.type === 'File' &&\n !this.unlink &&\n st.isFile() &&\n st.nlink <= 1 &&\n !this.win32\n )\n }\n\n /**\n * The parts of the path from the extraction directory to the\n * target of a link entry. None of them can be a symbolic link.\n */\n linkParts(entry: E, absolute: string): string[] {\n const linkpath = String(entry.linkpath)\n return entry.type === 'Link' ?\n linkpath.split('/')\n : relative(\n this.cwd,\n this.resolve(this.dirname(absolute), linkpath),\n ).split('/')\n }\n\n /** The error for a link target that goes through a symbolic link. */\n symlinkError(symlink: string, parts: string[]): SymlinkError {\n return new SymlinkError(\n symlink,\n this.resolve(this.cwd, parts.join('/')),\n )\n }\n}\n\n// Unlinks on Windows are not atomic. A file that is made at the path\n// of a file that was just removed can be removed with it. So rename\n// the file first, and then remove it under the new name.\nconst deleteName = (path: string) =>\n path +\n '.DELETE.' +\n Array.from(crypto.getRandomValues(new Uint8Array(16)), b =>\n b.toString(16).padStart(2, '0'),\n ).join('')\n\n/**\n * Extracts the entries of an archive with async file system\n * functions.\n *\n * Several entries are extracted at one time. Entries that use the\n * same path, or a path and a directory above it, are extracted in\n * the order of the archive.\n */\nexport class Unpack extends UnpackBase<ReadEntry, ExtractOptions> {\n #fs: ExtractFS\n #reservations: PathReservations\n #jobs: number\n // the number of entries that are in work\n #active: number = 0\n #wake?: () => void\n #checkedCwd: boolean = false\n #cwdCheck?: Promise<void>\n\n constructor(opt: ExtractOptions) {\n super(opt)\n this.#fs = this.opt.fs\n this.#reservations = new PathReservations(this.win32)\n this.#jobs = countOption('jobs', this.opt.jobs, DEFAULT_JOBS)\n }\n\n /**\n * Extract the archive. The promise settles when all the file\n * system work is done. It rejects with the first error that stops\n * the extraction.\n */\n async extract(input: TarInput): Promise<void> {\n const reader = new TarReader(input, this.readerOptions())\n const { onEntry } = this.opt\n const stream = !!this.opt.transform\n try {\n while (!this.fatal) {\n const entry = reader.poll()\n if (entry === null) break\n if (entry === undefined) {\n await reader.fill()\n continue\n }\n if (onEntry) await onEntry(entry)\n // The caller took the content, so there is nothing to write.\n if (entry.bodyUsed) continue\n if (!this.check(entry)) continue\n\n // A file whose content is all in memory is written while the\n // next entries are read. Other files are written as their\n // content arrives.\n const body: Uint8Array[] = []\n let inMemory = !stream\n if (inMemory && fileTypes.has(entry.type)) {\n for (;;) {\n const part = reader.readBody(entry)\n if (part === null) break\n if (part === undefined) {\n inMemory = false\n break\n }\n body.push(part)\n }\n }\n const work = this.#start(\n entry,\n body,\n inMemory ? undefined : reader,\n )\n if (!inMemory) await work\n while (this.#active >= this.#jobs) await this.#idle()\n }\n } catch (er) {\n this.fail(er)\n }\n await reader.return().catch(er => this.fail(er))\n while (this.#active > 0) await this.#idle()\n if (this.fatal) {\n const { error } = this.fatal\n if (error && typeof error === 'object' && 'tarCode' in error) {\n Object.assign(error, { cwd: this.cwd })\n }\n throw error\n }\n }\n\n // Resolves when an entry that is in work is done.\n #idle(): Promise<void> {\n return new Promise<void>(res => {\n this.#wake = res\n })\n }\n\n // Extract the entry when its paths are free. The promise never\n // rejects: a failure is a warning, or it sets `fatal`.\n #start(\n entry: ReadEntry,\n body: Uint8Array[],\n reader: TarReader | undefined,\n ): Promise<void> {\n this.#active++\n return this.#reservations.reserve(\n this.reservedPaths(entry),\n async () => {\n try {\n if (!this.fatal) await this.#extract(entry, body, reader)\n } catch (er) {\n try {\n this.entryError(er, entry)\n } catch (fatal) {\n this.fail(fatal)\n }\n }\n this.#active--\n this.#wake?.()\n },\n )\n }\n\n #mkdir(dir: string, mode: number): Promise<void> {\n return mkdir(this.#fs, dir, this.mkdirOptions(mode))\n }\n\n // The extraction directory must exist. Entries that start at the\n // same time share one check.\n #checkCwd(): Promise<void> {\n return (this.#cwdCheck ??= this.#mkdir(this.cwd, this.dmode).then(\n () => {\n this.#checkedCwd = true\n },\n er => {\n this.#cwdCheck = undefined\n throw er\n },\n ))\n }\n\n async #extract(\n entry: ReadEntry,\n body: Uint8Array[],\n reader: TarReader | undefined,\n ): Promise<void> {\n const fs = this.#fs\n const absolute = entry.absolute as string\n const { cwd } = this\n if (!this.#checkedCwd) await this.#checkCwd()\n if (absolute !== cwd) {\n const parent = this.dirname(absolute)\n if (parent !== cwd) await this.#mkdir(parent, this.dmode)\n }\n\n // Remove what is at the path, if the entry cannot use it.\n const st = await fs.lstat(absolute).catch(() => undefined)\n if (st && this.skip(entry, st)) return\n if (st && !this.isReusable(entry, st)) {\n if (st.isDirectory() && dirTypes.has(entry.type)) {\n if (\n this.chmod &&\n entry.mode &&\n (st.mode & 0o7777) !== entry.mode\n ) {\n await fs.chmod(absolute, entry.mode)\n }\n } else if (absolute !== cwd) {\n if (st.isDirectory()) await fs.rmdir(absolute)\n else await this.#unlink(absolute)\n }\n }\n\n if (fileTypes.has(entry.type)) {\n return this.#file(entry, absolute, body, reader)\n }\n if (dirTypes.has(entry.type)) return this.#directory(entry, absolute)\n await this.#ensureNoSymlink(this.linkParts(entry, absolute))\n const linkpath = String(entry.linkpath)\n if (entry.type === 'Link') {\n await fs.link(this.resolve(cwd, linkpath), absolute)\n } else {\n await fs.symlink(linkpath, absolute)\n }\n }\n\n async #unlink(path: string): Promise<void> {\n const fs = this.#fs\n if (!this.win32) return fs.unlink(path)\n const name = deleteName(path)\n await fs.rename(path, name)\n await fs.unlink(name)\n }\n\n async #ensureNoSymlink(parts: string[]): Promise<void> {\n if (this.preservePaths) return\n let t = this.cwd\n for (const p of parts) {\n t = this.resolve(t, p)\n const st = await this.#fs.lstat(t).catch(() => undefined)\n if (!st) return\n if (st.isSymbolicLink()) throw this.symlinkError(t, parts)\n }\n }\n\n async #directory(entry: ReadEntry, absolute: string): Promise<void> {\n const fs = this.#fs\n await this.#mkdir(absolute, entry.mode ?? this.dmode)\n // These do not follow a symbolic link that replaced the\n // directory. A failure is not an error of the entry.\n const times = this.times(entry)\n if (times) {\n await fs.lutimes(absolute, times.atime, times.mtime).catch(() => {})\n }\n const owner = this.owner(entry)\n if (owner) {\n await fs.lchown(absolute, owner.uid, owner.gid).catch(() => {})\n }\n }\n\n async #file(\n entry: ReadEntry,\n absolute: string,\n body: Uint8Array[],\n reader: TarReader | undefined,\n ): Promise<void> {\n const fs = this.#fs\n const handle = await fs.open(\n absolute,\n this.writeFlag(entry.size),\n entry.mode ?? this.fmode,\n )\n try {\n if (reader) await this.#pipe(entry, body, reader, handle)\n else for (const part of body) await handle.write(part)\n\n // Use the open file, so that a symbolic link that replaced the\n // path is not followed. If that fails, use the path.\n const times = this.times(entry)\n if (times) {\n const { atime, mtime } = times\n await handle.utimes(atime, mtime).catch(async er => {\n await fs.utimes(absolute, atime, mtime).catch(() => {\n throw er\n })\n })\n }\n const owner = this.owner(entry)\n if (owner) {\n const { uid, gid } = owner\n await handle.chown(uid, gid).catch(async er => {\n await fs.chown(absolute, uid, gid).catch(() => {\n throw er\n })\n })\n }\n } catch (er) {\n await handle.close().catch(() => {})\n throw er\n }\n await handle.close()\n }\n\n // Write the content of the entry as it arrives, through the\n // transform stream if there is one.\n async #pipe(\n entry: ReadEntry,\n body: Uint8Array[],\n reader: TarReader,\n handle: { write(data: Uint8Array): Promise<unknown> },\n ): Promise<void> {\n let i = 0\n const next = async (): Promise<Uint8Array | null> => {\n if (i < body.length) return body[i++] as Uint8Array\n try {\n for (;;) {\n const part = reader.readBody(entry)\n if (part !== undefined) return part\n await reader.fill()\n }\n } catch (er) {\n // The archive cannot be read.\n throw this.fail(er)\n }\n }\n\n const tx = this.opt.transform?.(entry)\n if (!tx) {\n // Write one part while the next part is read.\n let writing: Promise<void> | undefined\n let failed: { error: unknown } | undefined\n try {\n for (let part; (part = await next()); ) {\n await writing\n if (failed) break\n writing = handle.write(part).then(\n () => {},\n error => {\n failed = { error }\n },\n )\n }\n } finally {\n await writing\n }\n if (failed) throw failed.error\n return\n }\n\n const writer = tx.writable.getWriter()\n const out = tx.readable.getReader()\n let failed: { error: unknown } | undefined\n // Stop the two streams. A read that waits gets the end of the\n // stream, and a write that waits fails.\n const stop = async (error: unknown) => {\n failed ??= { error }\n await out.cancel(error).catch(() => {})\n await writer.abort(error).catch(() => {})\n }\n const feed = (async () => {\n try {\n for (let part; (part = await next()); ) await writer.write(part)\n await writer.close()\n } catch (er) {\n await stop(er)\n }\n })()\n try {\n for (;;) {\n const { done, value } = await out.read()\n if (done) break\n await handle.write(value)\n }\n } catch (er) {\n await stop(er)\n }\n // The feed reads the archive, so it must end before the next\n // entry is read.\n await feed\n if (failed) throw failed.error\n }\n}\n\n/**\n * Extracts the entries of an archive with sync file system\n * functions, one entry at a time.\n */\nexport class UnpackSync extends UnpackBase<\n ReadEntrySync,\n ExtractOptionsSync\n> {\n #fs: ExtractFSSync\n #checkedCwd: boolean = false\n\n constructor(opt: ExtractOptionsSync) {\n super(opt)\n this.#fs = this.opt.fs\n }\n\n /** Extract the archive. Throws the first error that stops it. */\n extract(input: TarInputSync): void {\n const reader = new TarReaderSync(input, this.readerOptions())\n const { onEntry } = this.opt\n try {\n for (const entry of reader) {\n onEntry?.(entry)\n if (entry.bodyUsed) continue\n if (!this.check(entry)) continue\n try {\n this.#extract(entry, reader)\n } catch (er) {\n this.entryError(er, entry)\n }\n }\n } catch (error) {\n if (error && typeof error === 'object' && 'tarCode' in error) {\n Object.assign(error, { cwd: this.cwd })\n }\n throw error\n }\n }\n\n #mkdir(dir: string, mode: number): void {\n mkdirSync(this.#fs, dir, this.mkdirOptions(mode))\n }\n\n #extract(entry: ReadEntrySync, reader: TarReaderSync): void {\n const fs = this.#fs\n const absolute = entry.absolute as string\n const { cwd } = this\n if (!this.#checkedCwd) {\n this.#mkdir(cwd, this.dmode)\n this.#checkedCwd = true\n }\n if (absolute !== cwd) {\n const parent = this.dirname(absolute)\n if (parent !== cwd) this.#mkdir(parent, this.dmode)\n }\n\n // Remove what is at the path, if the entry cannot use it.\n let st: ExtractStats | undefined\n try {\n st = fs.lstatSync(absolute)\n } catch {}\n if (st && this.skip(entry, st)) return\n if (st && !this.isReusable(entry, st)) {\n if (st.isDirectory() && dirTypes.has(entry.type)) {\n if (\n this.chmod &&\n entry.mode &&\n (st.mode & 0o7777) !== entry.mode\n ) {\n fs.chmodSync(absolute, entry.mode)\n }\n } else if (absolute !== cwd) {\n if (st.isDirectory()) fs.rmdirSync(absolute)\n else this.#unlink(absolute)\n }\n }\n\n if (fileTypes.has(entry.type)) {\n return this.#file(entry, absolute, reader)\n }\n if (dirTypes.has(entry.type)) return this.#directory(entry, absolute)\n this.#ensureNoSymlink(this.linkParts(entry, absolute))\n const linkpath = String(entry.linkpath)\n if (entry.type === 'Link') {\n fs.linkSync(this.resolve(cwd, linkpath), absolute)\n } else {\n fs.symlinkSync(linkpath, absolute)\n }\n }\n\n #unlink(path: string): void {\n const fs = this.#fs\n if (!this.win32) return fs.unlinkSync(path)\n const name = deleteName(path)\n fs.renameSync(path, name)\n fs.unlinkSync(name)\n }\n\n #ensureNoSymlink(parts: string[]): void {\n if (this.preservePaths) return\n let t = this.cwd\n for (const p of parts) {\n t = this.resolve(t, p)\n let st: ExtractStats\n try {\n st = this.#fs.lstatSync(t)\n } catch {\n return\n }\n if (st.isSymbolicLink()) throw this.symlinkError(t, parts)\n }\n }\n\n #directory(entry: ReadEntrySync, absolute: string): void {\n const fs = this.#fs\n this.#mkdir(absolute, entry.mode ?? this.dmode)\n // These do not follow a symbolic link that replaced the\n // directory. A failure is not an error of the entry.\n const times = this.times(entry)\n if (times) {\n try {\n fs.lutimesSync(absolute, times.atime, times.mtime)\n } catch {}\n }\n const owner = this.owner(entry)\n if (owner) {\n try {\n fs.lchownSync(absolute, owner.uid, owner.gid)\n } catch {}\n }\n }\n\n #file(\n entry: ReadEntrySync,\n absolute: string,\n reader: TarReaderSync,\n ): void {\n const fs = this.#fs\n const fd = fs.openSync(\n absolute,\n this.writeFlag(entry.size),\n entry.mode ?? this.fmode,\n )\n try {\n const tx = this.opt.transform?.(entry)\n for (;;) {\n let part: Uint8Array | null\n try {\n part = reader.readBody(entry)\n } catch (er) {\n // The archive cannot be read.\n throw this.fail(er)\n }\n if (!part) break\n fs.writeSync(fd, tx ? tx(part) : part)\n }\n\n // Use the open file, so that a symbolic link that replaced the\n // path is not followed. If that fails, use the path.\n const times = this.times(entry)\n if (times) {\n const { atime, mtime } = times\n try {\n fs.futimesSync(fd, atime, mtime)\n } catch (er) {\n try {\n fs.utimesSync(absolute, atime, mtime)\n } catch {\n throw er\n }\n }\n }\n const owner = this.owner(entry)\n if (owner) {\n const { uid, gid } = owner\n try {\n fs.fchownSync(fd, uid, gid)\n } catch (er) {\n try {\n fs.chownSync(absolute, uid, gid)\n } catch {\n throw er\n }\n }\n }\n } catch (er) {\n // Close the file one time, and do not use the descriptor again:\n // the system can give its number to a different file.\n try {\n fs.closeSync(fd)\n } catch {}\n throw er\n }\n fs.closeSync(fd)\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"unpack.js","sourceRoot":"","sources":["../../src/unpack.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yDAAiD;AAEjD,kDAAmC;AACnC,6CAAuD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CAAC,CAAA;YAClB,CAAC;YAAC,MAAM,CAAC,CAAA,CAAC;YACV,MAAM,EAAE,CAAA;QACV,CAAC;QACD,EAAE,CAAC,SAAS,CAAC,EAAE,CAAC,CAAA;IAClB,CAAC;CACF;AArMD,gCAqMC","sourcesContent":["import { SymlinkError } from './symlink-error.js'\nimport type { EntryTypeName } from './types.js'\nimport * as wc from './winchars.js'\nimport { TarReader, TarReaderSync } from './entries.js'\nimport type { ExtractFS, ExtractFSSync, ExtractStats } from './fs.js'\nimport { mkdir, mkdirSync, type MkdirOptions } from './mkdir.js'\nimport {\n countOption,\n ownOptions,\n type ExtractOptions,\n type ExtractOptionsSync,\n type ReadOptions,\n type TarInput,\n type TarInputSync,\n type UnpackOptions,\n} from './options.js'\nimport { PathReservations } from './path-reservations.js'\nimport {\n dirname,\n isAbsolute,\n join,\n normalize,\n relative,\n resolve,\n} from './path.js'\nimport type { EntryData, ReadEntry, ReadEntrySync } from './read-entry.js'\nimport { stripAbsolutePath } from './strip-absolute-path.js'\nimport { warn, type WarnData } from './warn.js'\nimport {\n win32Dirname,\n win32IsAbsolute,\n win32Resolve,\n win32Root,\n} from './win32-path.js'\nimport { writeFlags, type OpenConstants } from './write-flag.js'\n\nconst DEFAULT_MAX_DEPTH = 1024\n// Longer than any path that a supported platform can create.\nconst MAX_PATH_LENGTH = 32768\nconst DEFAULT_JOBS = 16\n\nconst fileTypes = new Set<EntryTypeName>([\n 'File',\n 'OldFile',\n 'ContiguousFile',\n])\nconst dirTypes = new Set<EntryTypeName>(['Directory', 'GNUDumpDir'])\nconst linkTypes = new Set<EntryTypeName>(['Link', 'SymbolicLink'])\n\n// The first of the values that is an unsigned 32-bit integer, or the\n// last value.\nconst uint32 = (\n a: number | undefined,\n b: number | undefined,\n c: number | undefined,\n) =>\n a !== undefined ? a\n : b !== undefined && b === b >>> 0 ? b\n : c\n\n/** The options that `UnpackBase` reads. */\nexport type UnpackBaseOptions<E extends EntryData> = ReadOptions<E> &\n UnpackOptions & { fs: { constants?: OpenConstants } }\n\n/**\n * The parts of the extraction that do not use the file system: the\n * options, the checks of each entry, and the warnings. `Unpack` and\n * `UnpackSync` add the file system work.\n */\nexport class UnpackBase<\n E extends EntryData,\n O extends UnpackBaseOptions<E> = UnpackBaseOptions<E>,\n> {\n /** The options, with no prototype. */\n opt: O\n /** The absolute path of the extraction directory. */\n cwd: string\n win32: boolean\n strip: number\n maxDepth: number\n preservePaths: boolean\n unlink: boolean\n keep: boolean\n newer: boolean\n noMtime: boolean\n chmod: boolean\n uid?: number\n gid?: number\n preserveOwner: boolean\n forceChown: boolean\n processUid?: number\n processGid?: number\n processUmask: number\n umask: number\n dmode: number\n fmode: number\n /** Gives the `open` flag for a new file of a given size. */\n writeFlag: (size: number) => string | number\n /** Resolve a path from an absolute path. */\n resolve: (base: string, path: string) => string\n /** The parent directory of an absolute path. */\n dirname: (path: string) => string\n /** Set when an error stops the extraction. */\n fatal?: { error: unknown }\n\n constructor(options: O) {\n const opt = (this.opt = ownOptions(options))\n const win32 = (this.win32 = opt.platform === 'win32')\n this.resolve = win32 ? win32Resolve : resolve\n this.dirname = win32 ? win32Dirname : dirname\n\n if (typeof opt.cwd !== 'string') {\n throw new TypeError('cwd is required')\n }\n const cwd = win32 ? opt.cwd.replaceAll('\\\\', '/') : opt.cwd\n if (!(win32 ? win32IsAbsolute : isAbsolute)(cwd)) {\n throw new TypeError('cwd must be an absolute path')\n }\n this.cwd = this.resolve(cwd, '')\n\n if (typeof opt.uid === 'number' || typeof opt.gid === 'number') {\n // need both or neither\n if (typeof opt.uid !== 'number' || typeof opt.gid !== 'number') {\n throw new TypeError('cannot set owner without number uid and gid')\n }\n // A value that is not valid must not fall back to the owner\n // in the archive.\n if (opt.uid !== opt.uid >>> 0 || opt.gid !== opt.gid >>> 0) {\n throw new TypeError('uid and gid must be unsigned 32-bit integers')\n }\n if (opt.preserveOwner) {\n throw new TypeError(\n 'cannot preserve owner in archive and also set owner explicitly',\n )\n }\n this.uid = opt.uid\n this.gid = opt.gid\n }\n this.processUid = opt.processUid\n this.processGid = opt.processGid\n this.preserveOwner =\n opt.preserveOwner === undefined && typeof opt.uid !== 'number' ?\n opt.processUid === 0\n : !!opt.preserveOwner\n this.forceChown = opt.forceChown === true\n\n this.maxDepth =\n typeof opt.maxDepth === 'number' ? opt.maxDepth : DEFAULT_MAX_DEPTH\n this.strip = Number(opt.strip) || 0\n this.preservePaths = !!opt.preservePaths\n this.unlink = !!opt.unlink\n this.keep = !!opt.keep\n this.newer = !!opt.newer\n this.noMtime = !!opt.noMtime\n this.chmod = !!opt.chmod\n\n // Without chmod, the umask of the process is not needed.\n this.processUmask =\n !this.chmod ? 0\n : typeof opt.processUmask === 'number' ? opt.processUmask\n : 0o22\n this.umask =\n typeof opt.umask === 'number' ? opt.umask : this.processUmask\n this.dmode = opt.dmode || 0o777 & ~this.umask\n this.fmode = opt.fmode || 0o666 & ~this.umask\n\n this.writeFlag = writeFlags(opt.fs.constants, win32)\n }\n\n /**\n * Report a problem to `onwarn`, or throw it if `strict` is set. A\n * damaged archive is always an error here, because the extraction\n * cannot be complete.\n */\n warn(code: string, message: string | Error, data: WarnData = {}): void {\n if (code === 'TAR_BAD_ARCHIVE' || code === 'TAR_ABORT') {\n data.recoverable = false\n }\n data.cwd = this.cwd\n warn(this.opt, code, message, data)\n }\n\n /** The options for the reader. Its warnings go to `warn()`. */\n readerOptions(): ReadOptions<E> {\n return ownOptions<ReadOptions<E>>(this.opt, {\n strict: false,\n onwarn: (code, message, data) =>\n data instanceof Error ?\n this.warn(code, data)\n : this.warn(code, message, data),\n })\n }\n\n /**\n * Report the failure of one entry as a `TAR_ENTRY_ERROR` warning.\n * Throws the error if it stops the extraction: the extraction\n * directory is not usable, the archive cannot be read, or `strict`\n * is set.\n */\n entryError(er: unknown, entry: E): void {\n if (this.fatal?.error === er || (er as Error)?.name === 'CwdError') {\n throw er\n }\n this.warn('TAR_ENTRY_ERROR', er as Error, { entry })\n }\n\n /** Record the error that stops the extraction. Returns it. */\n fail(error: unknown): unknown {\n this.fatal ??= { error }\n return error\n }\n\n // Remove the root of an absolute path, and refuse a path that can\n // leave the extraction directory. False if the entry is refused.\n #stripAbsolutePath(entry: E, field: 'path' | 'linkpath'): boolean {\n const p = entry[field]\n if (!p || this.preservePaths) return true\n\n const [root, stripped] = stripAbsolutePath(p)\n const parts = stripped.replaceAll('\\\\', '/').split('/')\n\n if (parts.includes('..')) {\n // A path, and the target of a hard link, cannot have '..' at\n // all. The target of a symbolic link is relative to the\n // directory of the link, so '../sibling/file' can be valid.\n if (field === 'path' || entry.type === 'Link') {\n this.warn('TAR_ENTRY_ERROR', `${field} contains '..'`, {\n entry,\n [field]: p,\n })\n return false\n }\n // A '..' is only safe at the start of the target. Any named\n // part before it can be a symlink, and then the '..' goes to\n // the parent of the target of that symlink.\n const firstName = parts.findIndex(\n part => part !== '..' && part !== '.' && part !== '',\n )\n if (firstName !== -1 && parts.includes('..', firstName)) {\n this.warn(\n 'TAR_ENTRY_ERROR',\n `${field} contains '..' after a path portion`,\n { entry, [field]: p },\n )\n return false\n }\n // Normalize the path, so that the directory is the one where\n // the link is created. The path 'x/.' creates the link 'x'.\n const entryDir = dirname(normalize(entry.path))\n const resolved = normalize(join(entryDir, parts.join('/')))\n if (resolved.startsWith('../') || resolved === '..') {\n this.warn(\n 'TAR_ENTRY_ERROR',\n `${field} escapes extraction directory`,\n { entry, [field]: p },\n )\n return false\n }\n }\n\n if (root) {\n ;(entry as EntryData)[field] = stripped\n this.warn(\n 'TAR_ENTRY_INFO',\n `stripping ${root} from absolute ${field}`,\n { entry, [field]: p },\n )\n }\n return true\n }\n\n /**\n * Check the entry, with no use of the file system. Set its\n * `absolute` path, and change its `path`, `linkpath`, and `mode` to\n * the values to extract. False if the entry must not be extracted.\n */\n check(entry: E): boolean {\n const p = entry.path\n const parts = p.split('/')\n\n if (this.strip) {\n if (parts.length < this.strip) return false\n if (entry.type === 'Link') {\n const linkparts = String(entry.linkpath).split('/')\n if (linkparts.length < this.strip) return false\n entry.linkpath = linkparts.slice(this.strip).join('/')\n }\n parts.splice(0, this.strip)\n // No part of the path is left, as for the top directory of a\n // package. The entry must not change the extraction directory.\n if (parts.every(part => part === '')) return false\n entry.path = parts.join('/')\n }\n\n const { maxDepth } = this\n if (isFinite(maxDepth) && parts.length > maxDepth) {\n this.warn('TAR_ENTRY_ERROR', 'path excessively deep', {\n entry,\n path: p,\n depth: parts.length,\n maxDepth,\n })\n return false\n }\n // The path reservations do work for each parent directory of the\n // path and of the linkpath.\n const { linkpath } = entry\n if (\n linkpath &&\n isFinite(maxDepth) &&\n linkpath.split('/').length > maxDepth\n ) {\n this.warn('TAR_ENTRY_ERROR', 'linkpath excessively deep', {\n entry,\n path: p,\n linkpath,\n maxDepth,\n })\n return false\n }\n for (const field of ['path', 'linkpath'] as const) {\n const { length } = entry[field] ?? ''\n if (length > MAX_PATH_LENGTH) {\n this.warn('TAR_ENTRY_ERROR', `${field} excessively long`, {\n entry,\n path: p,\n length,\n maxLength: MAX_PATH_LENGTH,\n })\n return false\n }\n }\n\n if (\n !this.#stripAbsolutePath(entry, 'path') ||\n !this.#stripAbsolutePath(entry, 'linkpath')\n ) {\n return false\n }\n\n const { cwd } = this\n let absolute = this.resolve(cwd, entry.path)\n\n // The checks above refuse a path that leaves the extraction\n // directory. This check is defense in depth.\n if (\n !this.preservePaths &&\n absolute !== cwd &&\n // A root, such as `/` or `c:/`, ends with a slash.\n !absolute.startsWith(cwd.endsWith('/') ? cwd : cwd + '/')\n ) {\n this.warn('TAR_ENTRY_ERROR', 'path escaped extraction target', {\n entry,\n path: entry.path,\n resolvedPath: absolute,\n cwd,\n })\n return false\n }\n\n // An archive can set properties of the extraction directory, but\n // it cannot replace it with a different kind of thing.\n if (absolute === cwd && !dirTypes.has(entry.type)) return false\n\n // Do not change the ':' of a drive letter.\n if (this.win32) {\n const aRoot = win32Root(absolute)\n absolute = aRoot + wc.encode(absolute.slice(aRoot.length))\n const pRoot = win32Root(entry.path)\n entry.path = pRoot + wc.encode(entry.path.slice(pRoot.length))\n }\n entry.absolute = absolute\n\n // Never set the setuid, setgid, or sticky bit from an archive.\n if (typeof entry.mode === 'number') entry.mode &= 0o777\n\n if (dirTypes.has(entry.type)) {\n if (entry.mode) entry.mode |= 0o700\n } else if (!fileTypes.has(entry.type) && !linkTypes.has(entry.type)) {\n // A device or a FIFO is never made.\n entry.unsupported = true\n this.warn(\n 'TAR_ENTRY_UNSUPPORTED',\n `unsupported entry type: ${entry.type}`,\n { entry },\n )\n return false\n }\n return true\n }\n\n /**\n * The paths that the entry must have for itself while it is made.\n * A link also reserves its target, so that an entry that makes the\n * target, and an entry that goes through the link, do not run at\n * the same time as the link.\n */\n reservedPaths(entry: E): string[] {\n const { path, linkpath } = entry\n if (!linkpath) return [path]\n // The target of a symlink is relative to the directory of the\n // link. The target of a hard link is relative to the cwd.\n return [\n path,\n entry.type === 'SymbolicLink' && !isAbsolute(linkpath) ?\n join(dirname(path), linkpath)\n : linkpath,\n ]\n }\n\n /** The options to make a directory with a mode. */\n mkdirOptions(mode: number): MkdirOptions {\n return {\n uid: this.uid,\n gid: this.gid,\n processUid: this.processUid,\n processGid: this.processGid,\n umask: this.processUmask,\n preserve: this.preservePaths,\n unlink: this.unlink,\n cwd: this.cwd,\n mode,\n }\n }\n\n /**\n * The owner to set on the entry, if it needs one: with\n * `preserveOwner`, when the owner in the archive is not the process\n * owner, and with `uid` and `gid`, when they are not the process\n * owner.\n */\n owner(entry: E): { uid: number; gid: number } | undefined {\n const doChown =\n this.forceChown ||\n (this.preserveOwner &&\n ((typeof entry.uid === 'number' &&\n entry.uid !== this.processUid) ||\n (typeof entry.gid === 'number' &&\n entry.gid !== this.processGid))) ||\n (typeof this.uid === 'number' && this.uid !== this.processUid) ||\n (typeof this.gid === 'number' && this.gid !== this.processGid)\n const uid = uint32(this.uid, entry.uid, this.processUid)\n const gid = uint32(this.gid, entry.gid, this.processGid)\n return doChown && typeof uid === 'number' && typeof gid === 'number' ?\n { uid, gid }\n : undefined\n }\n\n /** The times to set on the entry, if it needs them. */\n times(entry: E): { atime: Date; mtime: Date } | undefined {\n return entry.mtime && !this.noMtime ?\n { atime: entry.atime || new Date(), mtime: entry.mtime }\n : undefined\n }\n\n /** True if the object on disk at the path of the entry must stay. */\n skip(entry: E, st: ExtractStats): boolean {\n return (\n this.keep || (this.newer && st.mtime > (entry.mtime ?? st.mtime))\n )\n }\n\n /**\n * True if the entry can be written into the file that is on disk.\n * A file with more than one link is not used, because the write\n * would change the other links. Windows does not report a useful\n * link count.\n */\n isReusable(entry: E, st: ExtractStats): boolean {\n return (\n entry.type === 'File' &&\n !this.unlink &&\n st.isFile() &&\n st.nlink <= 1 &&\n !this.win32\n )\n }\n\n /**\n * The parts of the path from the extraction directory to the\n * target of a link entry. None of them can be a symbolic link.\n */\n linkParts(entry: E, absolute: string): string[] {\n const linkpath = String(entry.linkpath)\n return entry.type === 'Link' ?\n linkpath.split('/')\n : relative(\n this.cwd,\n this.resolve(this.dirname(absolute), linkpath),\n ).split('/')\n }\n\n /**\n * The parts of the path from the extraction directory to the\n * parent directory of an entry. The extraction checks them again\n * after it makes the entry: none of them can be a symbolic link\n * then. So a directory that another process replaced with a\n * symbolic link during the extraction is an error of the entry.\n */\n parentParts(absolute: string): string[] {\n const { cwd } = this\n const parent = absolute === cwd ? cwd : this.dirname(absolute)\n return parent === cwd ? [] : relative(cwd, parent).split('/')\n }\n\n /** The error for a link target that goes through a symbolic link. */\n symlinkError(symlink: string, parts: string[]): SymlinkError {\n return new SymlinkError(\n symlink,\n this.resolve(this.cwd, parts.join('/')),\n )\n }\n}\n\n// Unlinks on Windows are not atomic. A file that is made at the path\n// of a file that was just removed can be removed with it. So rename\n// the file first, and then remove it under the new name.\nconst deleteName = (path: string) =>\n path +\n '.DELETE.' +\n Array.from(crypto.getRandomValues(new Uint8Array(16)), b =>\n b.toString(16).padStart(2, '0'),\n ).join('')\n\n/**\n * Extracts the entries of an archive with async file system\n * functions.\n *\n * Several entries are extracted at one time. Entries that use the\n * same path, or a path and a directory above it, are extracted in\n * the order of the archive.\n */\nexport class Unpack extends UnpackBase<ReadEntry, ExtractOptions> {\n #fs: ExtractFS\n #reservations: PathReservations\n #jobs: number\n // the number of entries that are in work\n #active: number = 0\n #wake?: () => void\n #checkedCwd: boolean = false\n #cwdCheck?: Promise<void>\n\n constructor(opt: ExtractOptions) {\n super(opt)\n this.#fs = this.opt.fs\n this.#reservations = new PathReservations(this.win32)\n this.#jobs = countOption('jobs', this.opt.jobs, DEFAULT_JOBS)\n }\n\n /**\n * Extract the archive. The promise settles when all the file\n * system work is done. It rejects with the first error that stops\n * the extraction.\n */\n async extract(input: TarInput): Promise<void> {\n const reader = new TarReader(input, this.readerOptions())\n const { onEntry } = this.opt\n const stream = !!this.opt.transform\n try {\n while (!this.fatal) {\n const entry = reader.poll()\n if (entry === null) break\n if (entry === undefined) {\n await reader.fill()\n continue\n }\n if (onEntry) await onEntry(entry)\n // The caller took the content, so there is nothing to write.\n if (entry.bodyUsed) continue\n if (!this.check(entry)) continue\n\n // A file whose content is all in memory is written while the\n // next entries are read. Other files are written as their\n // content arrives.\n const body: Uint8Array[] = []\n let inMemory = !stream\n if (inMemory && fileTypes.has(entry.type)) {\n for (;;) {\n const part = reader.readBody(entry)\n if (part === null) break\n if (part === undefined) {\n inMemory = false\n break\n }\n body.push(part)\n }\n }\n const work = this.#start(\n entry,\n body,\n inMemory ? undefined : reader,\n )\n if (!inMemory) await work\n while (this.#active >= this.#jobs) await this.#idle()\n }\n } catch (er) {\n this.fail(er)\n }\n await reader.return().catch(er => this.fail(er))\n while (this.#active > 0) await this.#idle()\n if (this.fatal) {\n const { error } = this.fatal\n if (error && typeof error === 'object' && 'tarCode' in error) {\n Object.assign(error, { cwd: this.cwd })\n }\n throw error\n }\n }\n\n // Resolves when an entry that is in work is done.\n #idle(): Promise<void> {\n return new Promise<void>(res => {\n this.#wake = res\n })\n }\n\n // Extract the entry when its paths are free. The promise never\n // rejects: a failure is a warning, or it sets `fatal`.\n #start(\n entry: ReadEntry,\n body: Uint8Array[],\n reader: TarReader | undefined,\n ): Promise<void> {\n this.#active++\n return this.#reservations.reserve(\n this.reservedPaths(entry),\n async () => {\n try {\n if (!this.fatal) await this.#extract(entry, body, reader)\n } catch (er) {\n try {\n this.entryError(er, entry)\n } catch (fatal) {\n this.fail(fatal)\n }\n }\n this.#active--\n this.#wake?.()\n },\n )\n }\n\n #mkdir(dir: string, mode: number): Promise<void> {\n return mkdir(this.#fs, dir, this.mkdirOptions(mode))\n }\n\n // The extraction directory must exist. Entries that start at the\n // same time share one check.\n #checkCwd(): Promise<void> {\n return (this.#cwdCheck ??= this.#mkdir(this.cwd, this.dmode).then(\n () => {\n this.#checkedCwd = true\n },\n er => {\n this.#cwdCheck = undefined\n throw er\n },\n ))\n }\n\n async #extract(\n entry: ReadEntry,\n body: Uint8Array[],\n reader: TarReader | undefined,\n ): Promise<void> {\n const fs = this.#fs\n const absolute = entry.absolute as string\n const { cwd } = this\n if (!this.#checkedCwd) await this.#checkCwd()\n if (absolute !== cwd) {\n const parent = this.dirname(absolute)\n if (parent !== cwd) await this.#mkdir(parent, this.dmode)\n }\n\n // Remove what is at the path, if the entry cannot use it.\n const st = await fs.lstat(absolute).catch(() => undefined)\n if (st && this.skip(entry, st)) return\n if (st && !this.isReusable(entry, st)) {\n if (st.isDirectory() && dirTypes.has(entry.type)) {\n if (\n this.chmod &&\n entry.mode &&\n (st.mode & 0o7777) !== entry.mode\n ) {\n await fs.chmod(absolute, entry.mode)\n }\n } else if (absolute !== cwd) {\n if (st.isDirectory()) await fs.rmdir(absolute)\n else await this.#unlink(absolute)\n }\n }\n\n if (fileTypes.has(entry.type)) {\n return this.#file(entry, absolute, body, reader)\n }\n if (dirTypes.has(entry.type)) await this.#directory(entry, absolute)\n else {\n await this.#ensureNoSymlink(this.linkParts(entry, absolute))\n const linkpath = String(entry.linkpath)\n if (entry.type === 'Link') {\n await fs.link(this.resolve(cwd, linkpath), absolute)\n } else {\n await fs.symlink(linkpath, absolute)\n }\n }\n await this.#ensureNoSymlink(this.parentParts(absolute))\n }\n\n async #unlink(path: string): Promise<void> {\n const fs = this.#fs\n if (!this.win32) return fs.unlink(path)\n const name = deleteName(path)\n await fs.rename(path, name)\n await fs.unlink(name)\n }\n\n async #ensureNoSymlink(parts: string[]): Promise<void> {\n if (this.preservePaths) return\n let t = this.cwd\n for (const p of parts) {\n t = this.resolve(t, p)\n const st = await this.#fs.lstat(t).catch(() => undefined)\n if (!st) return\n if (st.isSymbolicLink()) throw this.symlinkError(t, parts)\n }\n }\n\n async #directory(entry: ReadEntry, absolute: string): Promise<void> {\n const fs = this.#fs\n await this.#mkdir(absolute, entry.mode ?? this.dmode)\n // These do not follow a symbolic link that replaced the\n // directory. A failure is not an error of the entry.\n const times = this.times(entry)\n if (times) {\n await fs.lutimes(absolute, times.atime, times.mtime).catch(() => {})\n }\n const owner = this.owner(entry)\n if (owner) {\n await fs.lchown(absolute, owner.uid, owner.gid).catch(() => {})\n }\n }\n\n async #file(\n entry: ReadEntry,\n absolute: string,\n body: Uint8Array[],\n reader: TarReader | undefined,\n ): Promise<void> {\n const fs = this.#fs\n const handle = await fs.open(\n absolute,\n this.writeFlag(entry.size),\n entry.mode ?? this.fmode,\n )\n try {\n // The file is open. Write to it only if no parent directory\n // became a symbolic link before the open.\n await this.#ensureNoSymlink(this.parentParts(absolute))\n if (reader) await this.#pipe(entry, body, reader, handle)\n else for (const part of body) await handle.write(part)\n\n // Use the open file, so that a symbolic link that replaced the\n // path is not followed. If that fails, use the path.\n const times = this.times(entry)\n if (times) {\n const { atime, mtime } = times\n await handle.utimes(atime, mtime).catch(async er => {\n await fs.utimes(absolute, atime, mtime).catch(() => {\n throw er\n })\n })\n }\n const owner = this.owner(entry)\n if (owner) {\n const { uid, gid } = owner\n await handle.chown(uid, gid).catch(async er => {\n await fs.chown(absolute, uid, gid).catch(() => {\n throw er\n })\n })\n }\n } catch (er) {\n await handle.close().catch(() => {})\n throw er\n }\n await handle.close()\n }\n\n // Write the content of the entry as it arrives, through the\n // transform stream if there is one.\n async #pipe(\n entry: ReadEntry,\n body: Uint8Array[],\n reader: TarReader,\n handle: { write(data: Uint8Array): Promise<unknown> },\n ): Promise<void> {\n let i = 0\n const next = async (): Promise<Uint8Array | null> => {\n if (i < body.length) return body[i++] as Uint8Array\n try {\n for (;;) {\n const part = reader.readBody(entry)\n if (part !== undefined) return part\n await reader.fill()\n }\n } catch (er) {\n // The archive cannot be read.\n throw this.fail(er)\n }\n }\n\n const tx = this.opt.transform?.(entry)\n if (!tx) {\n // Write one part while the next part is read.\n let writing: Promise<void> | undefined\n let failed: { error: unknown } | undefined\n try {\n for (let part; (part = await next()); ) {\n await writing\n if (failed) break\n writing = handle.write(part).then(\n () => {},\n error => {\n failed = { error }\n },\n )\n }\n } finally {\n await writing\n }\n if (failed) throw failed.error\n return\n }\n\n const writer = tx.writable.getWriter()\n const out = tx.readable.getReader()\n let failed: { error: unknown } | undefined\n // Stop the two streams. A read that waits gets the end of the\n // stream, and a write that waits fails.\n const stop = async (error: unknown) => {\n failed ??= { error }\n await out.cancel(error).catch(() => {})\n await writer.abort(error).catch(() => {})\n }\n const feed = (async () => {\n try {\n for (let part; (part = await next()); ) await writer.write(part)\n await writer.close()\n } catch (er) {\n await stop(er)\n }\n })()\n try {\n for (;;) {\n const { done, value } = await out.read()\n if (done) break\n await handle.write(value)\n }\n } catch (er) {\n await stop(er)\n }\n // The feed reads the archive, so it must end before the next\n // entry is read.\n await feed\n if (failed) throw failed.error\n }\n}\n\n/**\n * Extracts the entries of an archive with sync file system\n * functions, one entry at a time.\n */\nexport class UnpackSync extends UnpackBase<\n ReadEntrySync,\n ExtractOptionsSync\n> {\n #fs: ExtractFSSync\n #checkedCwd: boolean = false\n\n constructor(opt: ExtractOptionsSync) {\n super(opt)\n this.#fs = this.opt.fs\n }\n\n /** Extract the archive. Throws the first error that stops it. */\n extract(input: TarInputSync): void {\n const reader = new TarReaderSync(input, this.readerOptions())\n const { onEntry } = this.opt\n try {\n for (const entry of reader) {\n onEntry?.(entry)\n if (entry.bodyUsed) continue\n if (!this.check(entry)) continue\n try {\n this.#extract(entry, reader)\n } catch (er) {\n this.entryError(er, entry)\n }\n }\n } catch (error) {\n if (error && typeof error === 'object' && 'tarCode' in error) {\n Object.assign(error, { cwd: this.cwd })\n }\n throw error\n }\n }\n\n #mkdir(dir: string, mode: number): void {\n mkdirSync(this.#fs, dir, this.mkdirOptions(mode))\n }\n\n #extract(entry: ReadEntrySync, reader: TarReaderSync): void {\n const fs = this.#fs\n const absolute = entry.absolute as string\n const { cwd } = this\n if (!this.#checkedCwd) {\n this.#mkdir(cwd, this.dmode)\n this.#checkedCwd = true\n }\n if (absolute !== cwd) {\n const parent = this.dirname(absolute)\n if (parent !== cwd) this.#mkdir(parent, this.dmode)\n }\n\n // Remove what is at the path, if the entry cannot use it.\n let st: ExtractStats | undefined\n try {\n st = fs.lstatSync(absolute)\n } catch {}\n if (st && this.skip(entry, st)) return\n if (st && !this.isReusable(entry, st)) {\n if (st.isDirectory() && dirTypes.has(entry.type)) {\n if (\n this.chmod &&\n entry.mode &&\n (st.mode & 0o7777) !== entry.mode\n ) {\n fs.chmodSync(absolute, entry.mode)\n }\n } else if (absolute !== cwd) {\n if (st.isDirectory()) fs.rmdirSync(absolute)\n else this.#unlink(absolute)\n }\n }\n\n if (fileTypes.has(entry.type)) {\n return this.#file(entry, absolute, reader)\n }\n if (dirTypes.has(entry.type)) this.#directory(entry, absolute)\n else {\n this.#ensureNoSymlink(this.linkParts(entry, absolute))\n const linkpath = String(entry.linkpath)\n if (entry.type === 'Link') {\n fs.linkSync(this.resolve(cwd, linkpath), absolute)\n } else {\n fs.symlinkSync(linkpath, absolute)\n }\n }\n this.#ensureNoSymlink(this.parentParts(absolute))\n }\n\n #unlink(path: string): void {\n const fs = this.#fs\n if (!this.win32) return fs.unlinkSync(path)\n const name = deleteName(path)\n fs.renameSync(path, name)\n fs.unlinkSync(name)\n }\n\n #ensureNoSymlink(parts: string[]): void {\n if (this.preservePaths) return\n let t = this.cwd\n for (const p of parts) {\n t = this.resolve(t, p)\n let st: ExtractStats\n try {\n st = this.#fs.lstatSync(t)\n } catch {\n return\n }\n if (st.isSymbolicLink()) throw this.symlinkError(t, parts)\n }\n }\n\n #directory(entry: ReadEntrySync, absolute: string): void {\n const fs = this.#fs\n this.#mkdir(absolute, entry.mode ?? this.dmode)\n // These do not follow a symbolic link that replaced the\n // directory. A failure is not an error of the entry.\n const times = this.times(entry)\n if (times) {\n try {\n fs.lutimesSync(absolute, times.atime, times.mtime)\n } catch {}\n }\n const owner = this.owner(entry)\n if (owner) {\n try {\n fs.lchownSync(absolute, owner.uid, owner.gid)\n } catch {}\n }\n }\n\n #file(\n entry: ReadEntrySync,\n absolute: string,\n reader: TarReaderSync,\n ): void {\n const fs = this.#fs\n const fd = fs.openSync(\n absolute,\n this.writeFlag(entry.size),\n entry.mode ?? this.fmode,\n )\n try {\n // The file is open. Write to it only if no parent directory\n // became a symbolic link before the open.\n this.#ensureNoSymlink(this.parentParts(absolute))\n const tx = this.opt.transform?.(entry)\n for (;;) {\n let part: Uint8Array | null\n try {\n part = reader.readBody(entry)\n } catch (er) {\n // The archive cannot be read.\n throw this.fail(er)\n }\n if (!part) break\n fs.writeSync(fd, tx ? tx(part) : part)\n }\n\n // Use the open file, so that a symbolic link that replaced the\n // path is not followed. If that fails, use the path.\n const times = this.times(entry)\n if (times) {\n const { atime, mtime } = times\n try {\n fs.futimesSync(fd, atime, mtime)\n } catch (er) {\n try {\n fs.utimesSync(absolute, atime, mtime)\n } catch {\n throw er\n }\n }\n }\n const owner = this.owner(entry)\n if (owner) {\n const { uid, gid } = owner\n try {\n fs.fchownSync(fd, uid, gid)\n } catch (er) {\n try {\n fs.chownSync(absolute, uid, gid)\n } catch {\n throw er\n }\n }\n }\n } catch (er) {\n // Close the file one time, and do not use the descriptor again:\n // the system can give its number to a different file.\n try {\n fs.closeSync(fd)\n } catch {}\n throw er\n }\n fs.closeSync(fd)\n }\n}\n"]}
|