tar 7.5.24 → 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 +1712 -1147
- package/dist/commonjs/bytes.d.ts +21 -0
- package/dist/commonjs/bytes.d.ts.map +1 -0
- package/dist/commonjs/bytes.js +83 -0
- package/dist/commonjs/bytes.js.map +1 -0
- package/dist/commonjs/codec.d.ts +53 -0
- package/dist/commonjs/codec.d.ts.map +1 -0
- package/dist/commonjs/codec.js +35 -0
- package/dist/commonjs/codec.js.map +1 -0
- package/dist/commonjs/concat.d.ts +3 -0
- package/dist/commonjs/concat.d.ts.map +1 -0
- package/dist/commonjs/concat.js +20 -0
- package/dist/commonjs/concat.js.map +1 -0
- package/dist/commonjs/create.d.ts +39 -2
- package/dist/commonjs/create.d.ts.map +1 -1
- package/dist/commonjs/create.js +150 -64
- package/dist/commonjs/create.js.map +1 -1
- package/dist/commonjs/dealias.d.ts +79 -0
- package/dist/commonjs/dealias.d.ts.map +1 -0
- package/dist/commonjs/dealias.js +50 -0
- package/dist/commonjs/dealias.js.map +1 -0
- package/dist/commonjs/delete.d.ts +19 -0
- package/dist/commonjs/delete.d.ts.map +1 -0
- package/dist/commonjs/delete.js +121 -0
- package/dist/commonjs/delete.js.map +1 -0
- package/dist/commonjs/entries.d.ts +82 -0
- package/dist/commonjs/entries.d.ts.map +1 -0
- package/dist/commonjs/entries.js +398 -0
- package/dist/commonjs/entries.js.map +1 -0
- package/dist/commonjs/extract.d.ts +14 -2
- package/dist/commonjs/extract.d.ts.map +1 -1
- package/dist/commonjs/extract.js +40 -81
- package/dist/commonjs/extract.js.map +1 -1
- package/dist/commonjs/fs.d.ts +201 -0
- package/dist/commonjs/fs.d.ts.map +1 -0
- package/dist/commonjs/fs.js +5 -0
- package/dist/commonjs/fs.js.map +1 -0
- package/dist/commonjs/header.d.ts +4 -4
- package/dist/commonjs/header.d.ts.map +1 -1
- package/dist/commonjs/header.js +38 -42
- package/dist/commonjs/header.js.map +1 -1
- package/dist/commonjs/index.d.ts +25 -18
- package/dist/commonjs/index.d.ts.map +1 -1
- package/dist/commonjs/index.js +46 -18
- package/dist/commonjs/index.js.map +1 -1
- package/dist/commonjs/index.min.js +2 -3
- package/dist/commonjs/index.min.js.map +4 -4
- package/dist/commonjs/large-numbers.d.ts +2 -2
- package/dist/commonjs/large-numbers.d.ts.map +1 -1
- package/dist/commonjs/large-numbers.js +4 -4
- package/dist/commonjs/large-numbers.js.map +1 -1
- package/dist/commonjs/list.d.ts +23 -6
- package/dist/commonjs/list.d.ts.map +1 -1
- package/dist/commonjs/list.js +99 -138
- package/dist/commonjs/list.js.map +1 -1
- package/dist/commonjs/mkdir.d.ts +16 -11
- package/dist/commonjs/mkdir.d.ts.map +1 -1
- package/dist/commonjs/mkdir.js +121 -159
- package/dist/commonjs/mkdir.js.map +1 -1
- package/dist/commonjs/options.d.ts +284 -513
- package/dist/commonjs/options.d.ts.map +1 -1
- package/dist/commonjs/options.js +20 -61
- package/dist/commonjs/options.js.map +1 -1
- package/dist/commonjs/pack.d.ts +150 -96
- package/dist/commonjs/pack.d.ts.map +1 -1
- package/dist/commonjs/pack.js +752 -445
- package/dist/commonjs/pack.js.map +1 -1
- package/dist/commonjs/parser.d.ts +94 -0
- package/dist/commonjs/parser.d.ts.map +1 -0
- package/dist/commonjs/parser.js +381 -0
- package/dist/commonjs/parser.js.map +1 -0
- package/dist/commonjs/path-reservations.d.ts +17 -7
- package/dist/commonjs/path-reservations.d.ts.map +1 -1
- package/dist/commonjs/path-reservations.js +96 -119
- package/dist/commonjs/path-reservations.js.map +1 -1
- package/dist/commonjs/path.d.ts +19 -0
- package/dist/commonjs/path.d.ts.map +1 -0
- package/dist/commonjs/path.js +90 -0
- package/dist/commonjs/path.js.map +1 -0
- package/dist/commonjs/pax.d.ts +3 -1
- package/dist/commonjs/pax.d.ts.map +1 -1
- package/dist/commonjs/pax.js +53 -43
- package/dist/commonjs/pax.js.map +1 -1
- package/dist/commonjs/read-entry.d.ts +97 -11
- package/dist/commonjs/read-entry.d.ts.map +1 -1
- package/dist/commonjs/read-entry.js +248 -97
- package/dist/commonjs/read-entry.js.map +1 -1
- package/dist/commonjs/read-file.d.ts +22 -0
- package/dist/commonjs/read-file.d.ts.map +1 -0
- package/dist/commonjs/read-file.js +104 -0
- package/dist/commonjs/read-file.js.map +1 -0
- package/dist/commonjs/replace.d.ts +45 -1
- package/dist/commonjs/replace.d.ts.map +1 -1
- package/dist/commonjs/replace.js +165 -211
- package/dist/commonjs/replace.js.map +1 -1
- package/dist/commonjs/server/codecs.d.ts +38 -0
- package/dist/commonjs/server/codecs.d.ts.map +1 -0
- package/dist/commonjs/server/codecs.js +252 -0
- package/dist/commonjs/server/codecs.js.map +1 -0
- package/dist/commonjs/server/index.d.ts +115 -0
- package/dist/commonjs/server/index.d.ts.map +1 -0
- package/dist/commonjs/server/index.js +166 -0
- package/dist/commonjs/server/index.js.map +1 -0
- package/dist/commonjs/server/index.min.js +3 -0
- package/dist/commonjs/server/index.min.js.map +7 -0
- package/dist/commonjs/strip-absolute-path.d.ts +8 -0
- package/dist/commonjs/strip-absolute-path.d.ts.map +1 -1
- package/dist/commonjs/strip-absolute-path.js +17 -20
- package/dist/commonjs/strip-absolute-path.js.map +1 -1
- package/dist/commonjs/to-stream.d.ts +7 -0
- package/dist/commonjs/to-stream.d.ts.map +1 -0
- package/dist/commonjs/to-stream.js +22 -0
- package/dist/commonjs/to-stream.js.map +1 -0
- package/dist/commonjs/types.d.ts +4 -3
- package/dist/commonjs/types.d.ts.map +1 -1
- package/dist/commonjs/types.js +4 -3
- package/dist/commonjs/types.js.map +1 -1
- package/dist/commonjs/unpack.d.ts +143 -89
- package/dist/commonjs/unpack.d.ts.map +1 -1
- package/dist/commonjs/unpack.js +782 -725
- package/dist/commonjs/unpack.js.map +1 -1
- package/dist/commonjs/update.d.ts +11 -1
- package/dist/commonjs/update.d.ts.map +1 -1
- package/dist/commonjs/update.js +37 -28
- package/dist/commonjs/update.js.map +1 -1
- package/dist/commonjs/warn.d.ts +27 -0
- package/dist/commonjs/warn.d.ts.map +1 -0
- package/dist/commonjs/warn.js +36 -0
- package/dist/commonjs/warn.js.map +1 -0
- package/dist/commonjs/win32-path.d.ts +16 -0
- package/dist/commonjs/win32-path.d.ts.map +1 -0
- package/dist/commonjs/win32-path.js +67 -0
- package/dist/commonjs/win32-path.js.map +1 -0
- package/dist/commonjs/write-entry.d.ts +64 -111
- package/dist/commonjs/write-entry.d.ts.map +1 -1
- package/dist/commonjs/write-entry.js +108 -672
- package/dist/commonjs/write-entry.js.map +1 -1
- package/dist/commonjs/write-flag.d.ts +18 -0
- package/dist/commonjs/write-flag.d.ts.map +1 -0
- package/dist/commonjs/write-flag.js +29 -0
- package/dist/commonjs/write-flag.js.map +1 -0
- package/dist/esm/bytes.d.ts +21 -0
- package/dist/esm/bytes.d.ts.map +1 -0
- package/dist/esm/bytes.js +72 -0
- package/dist/esm/bytes.js.map +1 -0
- package/dist/esm/codec.d.ts +53 -0
- package/dist/esm/codec.d.ts.map +1 -0
- package/dist/esm/codec.js +32 -0
- package/dist/esm/codec.js.map +1 -0
- package/dist/esm/concat.d.ts +3 -0
- package/dist/esm/concat.d.ts.map +1 -0
- package/dist/esm/concat.js +16 -0
- package/dist/esm/concat.js.map +1 -0
- package/dist/esm/create.d.ts +39 -2
- package/dist/esm/create.d.ts.map +1 -1
- package/dist/esm/create.js +144 -61
- package/dist/esm/create.js.map +1 -1
- package/dist/esm/dealias.d.ts +79 -0
- package/dist/esm/dealias.d.ts.map +1 -0
- package/dist/esm/dealias.js +46 -0
- package/dist/esm/dealias.js.map +1 -0
- package/dist/esm/delete.d.ts +19 -0
- package/dist/esm/delete.d.ts.map +1 -0
- package/dist/esm/delete.js +117 -0
- package/dist/esm/delete.js.map +1 -0
- package/dist/esm/entries.d.ts +82 -0
- package/dist/esm/entries.d.ts.map +1 -0
- package/dist/esm/entries.js +388 -0
- package/dist/esm/entries.js.map +1 -0
- package/dist/esm/extract.d.ts +14 -2
- package/dist/esm/extract.d.ts.map +1 -1
- package/dist/esm/extract.js +37 -44
- package/dist/esm/extract.js.map +1 -1
- package/dist/esm/fs.d.ts +201 -0
- package/dist/esm/fs.d.ts.map +1 -0
- package/dist/esm/fs.js +4 -0
- package/dist/esm/fs.js.map +1 -0
- package/dist/esm/header.d.ts +4 -4
- package/dist/esm/header.d.ts.map +1 -1
- package/dist/esm/header.js +38 -42
- package/dist/esm/header.js.map +1 -1
- package/dist/esm/index.d.ts +25 -18
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +23 -18
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/index.min.js +2 -3
- package/dist/esm/index.min.js.map +4 -4
- package/dist/esm/large-numbers.d.ts +2 -2
- package/dist/esm/large-numbers.d.ts.map +1 -1
- package/dist/esm/large-numbers.js +4 -4
- package/dist/esm/large-numbers.js.map +1 -1
- package/dist/esm/list.d.ts +23 -6
- package/dist/esm/list.d.ts.map +1 -1
- package/dist/esm/list.js +96 -101
- package/dist/esm/list.js.map +1 -1
- package/dist/esm/mkdir.d.ts +16 -11
- package/dist/esm/mkdir.d.ts.map +1 -1
- package/dist/esm/mkdir.js +119 -154
- package/dist/esm/mkdir.js.map +1 -1
- package/dist/esm/options.d.ts +284 -513
- package/dist/esm/options.d.ts.map +1 -1
- package/dist/esm/options.js +17 -51
- package/dist/esm/options.js.map +1 -1
- package/dist/esm/pack.d.ts +150 -96
- package/dist/esm/pack.d.ts.map +1 -1
- package/dist/esm/pack.js +750 -441
- package/dist/esm/pack.js.map +1 -1
- package/dist/esm/parser.d.ts +94 -0
- package/dist/esm/parser.d.ts.map +1 -0
- package/dist/esm/parser.js +377 -0
- package/dist/esm/parser.js.map +1 -0
- package/dist/esm/path-reservations.d.ts +17 -7
- package/dist/esm/path-reservations.d.ts.map +1 -1
- package/dist/esm/path-reservations.js +96 -119
- package/dist/esm/path-reservations.js.map +1 -1
- package/dist/esm/path.d.ts +19 -0
- package/dist/esm/path.d.ts.map +1 -0
- package/dist/esm/path.js +80 -0
- package/dist/esm/path.js.map +1 -0
- package/dist/esm/pax.d.ts +3 -1
- package/dist/esm/pax.d.ts.map +1 -1
- package/dist/esm/pax.js +52 -42
- package/dist/esm/pax.js.map +1 -1
- package/dist/esm/read-entry.d.ts +97 -11
- package/dist/esm/read-entry.d.ts.map +1 -1
- package/dist/esm/read-entry.js +245 -96
- package/dist/esm/read-entry.js.map +1 -1
- package/dist/esm/read-file.d.ts +22 -0
- package/dist/esm/read-file.d.ts.map +1 -0
- package/dist/esm/read-file.js +99 -0
- package/dist/esm/read-file.js.map +1 -0
- package/dist/esm/replace.d.ts +45 -1
- package/dist/esm/replace.d.ts.map +1 -1
- package/dist/esm/replace.js +161 -207
- package/dist/esm/replace.js.map +1 -1
- package/dist/esm/server/codecs.d.ts +38 -0
- package/dist/esm/server/codecs.d.ts.map +1 -0
- package/dist/esm/server/codecs.js +214 -0
- package/dist/esm/server/codecs.js.map +1 -0
- package/dist/esm/server/index.d.ts +115 -0
- package/dist/esm/server/index.d.ts.map +1 -0
- package/dist/esm/server/index.js +102 -0
- package/dist/esm/server/index.js.map +1 -0
- package/dist/esm/server/index.min.js +3 -0
- package/dist/esm/server/index.min.js.map +7 -0
- package/dist/esm/strip-absolute-path.d.ts +8 -0
- package/dist/esm/strip-absolute-path.d.ts.map +1 -1
- package/dist/esm/strip-absolute-path.js +17 -20
- package/dist/esm/strip-absolute-path.js.map +1 -1
- package/dist/esm/to-stream.d.ts +7 -0
- package/dist/esm/to-stream.d.ts.map +1 -0
- package/dist/esm/to-stream.js +18 -0
- package/dist/esm/to-stream.js.map +1 -0
- package/dist/esm/types.d.ts +4 -3
- package/dist/esm/types.d.ts.map +1 -1
- package/dist/esm/types.js +4 -3
- package/dist/esm/types.js.map +1 -1
- package/dist/esm/unpack.d.ts +143 -89
- package/dist/esm/unpack.d.ts.map +1 -1
- package/dist/esm/unpack.js +778 -719
- package/dist/esm/unpack.js.map +1 -1
- package/dist/esm/update.d.ts +11 -1
- package/dist/esm/update.d.ts.map +1 -1
- package/dist/esm/update.js +35 -28
- package/dist/esm/update.js.map +1 -1
- package/dist/esm/warn.d.ts +27 -0
- package/dist/esm/warn.d.ts.map +1 -0
- package/dist/esm/warn.js +31 -0
- package/dist/esm/warn.js.map +1 -0
- package/dist/esm/win32-path.d.ts +16 -0
- package/dist/esm/win32-path.d.ts.map +1 -0
- package/dist/esm/win32-path.js +60 -0
- package/dist/esm/win32-path.js.map +1 -0
- package/dist/esm/write-entry.d.ts +64 -111
- package/dist/esm/write-entry.d.ts.map +1 -1
- package/dist/esm/write-entry.js +107 -633
- package/dist/esm/write-entry.js.map +1 -1
- package/dist/esm/write-flag.d.ts +18 -0
- package/dist/esm/write-flag.d.ts.map +1 -0
- package/dist/esm/write-flag.js +25 -0
- package/dist/esm/write-flag.js.map +1 -0
- package/package.json +68 -224
- package/dist/commonjs/get-write-flag.d.ts +0 -2
- package/dist/commonjs/get-write-flag.d.ts.map +0 -1
- package/dist/commonjs/get-write-flag.js +0 -32
- package/dist/commonjs/get-write-flag.js.map +0 -1
- package/dist/commonjs/make-command.d.ts +0 -49
- package/dist/commonjs/make-command.d.ts.map +0 -1
- package/dist/commonjs/make-command.js +0 -52
- package/dist/commonjs/make-command.js.map +0 -1
- package/dist/commonjs/normalize-windows-path.d.ts +0 -2
- package/dist/commonjs/normalize-windows-path.d.ts.map +0 -1
- package/dist/commonjs/normalize-windows-path.js +0 -12
- package/dist/commonjs/normalize-windows-path.js.map +0 -1
- package/dist/commonjs/parse.d.ts +0 -92
- package/dist/commonjs/parse.d.ts.map +0 -1
- package/dist/commonjs/parse.js +0 -655
- package/dist/commonjs/parse.js.map +0 -1
- package/dist/commonjs/process-umask.d.ts +0 -2
- package/dist/commonjs/process-umask.d.ts.map +0 -1
- package/dist/commonjs/process-umask.js +0 -7
- package/dist/commonjs/process-umask.js.map +0 -1
- package/dist/commonjs/warn-method.d.ts +0 -24
- package/dist/commonjs/warn-method.d.ts.map +0 -1
- package/dist/commonjs/warn-method.js +0 -31
- package/dist/commonjs/warn-method.js.map +0 -1
- package/dist/esm/get-write-flag.d.ts +0 -2
- package/dist/esm/get-write-flag.d.ts.map +0 -1
- package/dist/esm/get-write-flag.js +0 -26
- package/dist/esm/get-write-flag.js.map +0 -1
- package/dist/esm/make-command.d.ts +0 -49
- package/dist/esm/make-command.d.ts.map +0 -1
- package/dist/esm/make-command.js +0 -48
- package/dist/esm/make-command.js.map +0 -1
- package/dist/esm/normalize-windows-path.d.ts +0 -2
- package/dist/esm/normalize-windows-path.d.ts.map +0 -1
- package/dist/esm/normalize-windows-path.js +0 -9
- package/dist/esm/normalize-windows-path.js.map +0 -1
- package/dist/esm/parse.d.ts +0 -92
- package/dist/esm/parse.d.ts.map +0 -1
- package/dist/esm/parse.js +0 -651
- package/dist/esm/parse.js.map +0 -1
- package/dist/esm/process-umask.d.ts +0 -2
- package/dist/esm/process-umask.d.ts.map +0 -1
- package/dist/esm/process-umask.js +0 -3
- package/dist/esm/process-umask.js.map +0 -1
- package/dist/esm/warn-method.d.ts +0 -24
- package/dist/esm/warn-method.d.ts.map +0 -1
- package/dist/esm/warn-method.js +0 -27
- package/dist/esm/warn-method.js.map +0 -1
|
@@ -1,604 +1,375 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import type { Codec } from './codec.js';
|
|
2
|
+
import type { EntryData, ReadEntry, ReadEntrySync } from './read-entry.js';
|
|
3
|
+
import type { ExtractFS, ExtractFSSync, TarFS, TarFSSync } from './fs.js';
|
|
4
|
+
import type { WarnOptions } from './warn.js';
|
|
5
|
+
import type { CreateFS, CreateFSSync, CreateStats, DeleteFS, DeleteFSSync, ReplaceFS, ReplaceFSSync } from './fs.js';
|
|
5
6
|
import type { WriteEntry } from './write-entry.js';
|
|
6
7
|
/**
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* Note that some of these are only relevant for certain commands, since
|
|
10
|
-
* they are specific to reading or writing.
|
|
11
|
-
*
|
|
12
|
-
* Aliases are provided in the {@link TarOptionsWithAliases} type.
|
|
8
|
+
* A copy of the options with no prototype, so that an option that is
|
|
9
|
+
* not set cannot get a value from a changed `Object.prototype`.
|
|
13
10
|
*/
|
|
14
|
-
export
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
11
|
+
export declare const ownOptions: <T extends object>(opt: T, more?: Partial<T>) => T;
|
|
12
|
+
/**
|
|
13
|
+
* The value of an option that is a count, such as `jobs`: the
|
|
14
|
+
* default if the option is not set or is 0, and a `TypeError` if the
|
|
15
|
+
* value is not a positive integer or `Infinity`.
|
|
16
|
+
*/
|
|
17
|
+
export declare const countOption: (name: string, value: unknown, def: number) => number;
|
|
18
|
+
/** The options of a `Parser`. */
|
|
19
|
+
export type ParserOptions<E extends EntryData = EntryData> = WarnOptions & {
|
|
20
20
|
/**
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* when the operation is completed, and synchronous commands will return
|
|
24
|
-
* immediately.
|
|
21
|
+
* Called with each entry that is an object of the file system.
|
|
22
|
+
* If it returns false, the entry is ignored.
|
|
25
23
|
*/
|
|
26
|
-
|
|
24
|
+
filter?: (path: string, entry: E) => boolean;
|
|
27
25
|
/**
|
|
28
|
-
*
|
|
26
|
+
* The largest PAX or GNU long name entry to read, in bytes. A
|
|
27
|
+
* larger one is skipped. Default 1 MiB.
|
|
29
28
|
*/
|
|
30
|
-
|
|
29
|
+
maxMetaEntrySize?: number;
|
|
30
|
+
/** With `'win32'`, each `\` in a path is changed to `/`. */
|
|
31
|
+
platform?: 'win32' | 'posix';
|
|
32
|
+
};
|
|
33
|
+
/** The options of the readers. */
|
|
34
|
+
export type ReadOptions<E extends EntryData = ReadEntry> = ParserOptions<E> & {
|
|
31
35
|
/**
|
|
32
|
-
*
|
|
36
|
+
* Stop with an error when the decompressed size is more than this
|
|
37
|
+
* many times the compressed size. Default 1000.
|
|
33
38
|
*/
|
|
34
|
-
|
|
39
|
+
maxDecompressionRatio?: number;
|
|
35
40
|
/**
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
* needed.
|
|
39
|
-
*
|
|
40
|
-
* When reading, if this is unset, then the compression status will be
|
|
41
|
-
* inferred from the archive data. This is generally best, unless you are
|
|
42
|
-
* sure of the compression settings in use to create the archive, and want to
|
|
43
|
-
* fail if the archive doesn't match expectations.
|
|
44
|
-
*/
|
|
45
|
-
gzip?: boolean | GzipOptions;
|
|
46
|
-
/**
|
|
47
|
-
* When creating archives, preserve absolute and `..` paths in the archive,
|
|
48
|
-
* rather than sanitizing them under the cwd.
|
|
49
|
-
*
|
|
50
|
-
* When extracting, allow absolute paths, paths containing `..`, and
|
|
51
|
-
* extracting through symbolic links. By default, the root `/` is stripped
|
|
52
|
-
* from absolute paths (eg, turning `/x/y/z` into `x/y/z`), paths containing
|
|
53
|
-
* `..` are not extracted, and any file whose location would be modified by a
|
|
54
|
-
* symbolic link is not extracted.
|
|
55
|
-
*
|
|
56
|
-
* **WARNING** This is almost always unsafe, and must NEVER be used on
|
|
57
|
-
* archives from untrusted sources, such as user input, and every entry must
|
|
58
|
-
* be validated to ensure it is safe to write. Even if the input is not
|
|
59
|
-
* malicious, mistakes can cause a lot of damage!
|
|
41
|
+
* Compression formats, tried in order before the gzip support of
|
|
42
|
+
* the runtime.
|
|
60
43
|
*/
|
|
61
|
-
|
|
44
|
+
codecs?: Codec[];
|
|
45
|
+
};
|
|
46
|
+
/** The options of `entriesSync`. */
|
|
47
|
+
export type ReadOptionsSync = ReadOptions<ReadEntrySync>;
|
|
48
|
+
/** The archive data that `entries` reads. */
|
|
49
|
+
export type TarInput = Uint8Array | ArrayBuffer | Blob | ReadableStream<Uint8Array> | AsyncIterable<Uint8Array> | Iterable<Uint8Array>;
|
|
50
|
+
/** The archive data that `entriesSync` reads. */
|
|
51
|
+
export type TarInputSync = Uint8Array | ArrayBuffer | Iterable<Uint8Array>;
|
|
52
|
+
/** The options of `list`. Set `input`, or `file` and `fs`. */
|
|
53
|
+
export type ListOptions = ReadOptions & {
|
|
54
|
+
input?: TarInput;
|
|
55
|
+
/** The path of the archive file. */
|
|
56
|
+
file?: string;
|
|
57
|
+
fs?: TarFS;
|
|
62
58
|
/**
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
* When creating archives, do not store the `mtime` value in the entry. Note
|
|
67
|
-
* that this prevents properly using other mtime-based features (such as
|
|
68
|
-
* `tar.update` or the `newer` option) with the resulting archive.
|
|
59
|
+
* The most bytes to read from the file at one time. Default, and
|
|
60
|
+
* with 0, 16 MiB. A positive integer, or `Infinity`.
|
|
69
61
|
*/
|
|
70
|
-
|
|
62
|
+
maxReadSize?: number;
|
|
71
63
|
/**
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
* When extracting, this will cause the archive to be treated as a
|
|
76
|
-
* brotli-compressed file if set to `true` or a ZlibOptions object.
|
|
77
|
-
*
|
|
78
|
-
* If set `false`, then brotli options will not be used.
|
|
79
|
-
*
|
|
80
|
-
* If this, the `gzip`, and `zstd` options are left `undefined`, then tar
|
|
81
|
-
* will attempt to infer the brotli compression status, but can only do so
|
|
82
|
-
* based on the filename. If the filename ends in `.tbr` or `.tar.br`, and
|
|
83
|
-
* the first 512 bytes are not a valid tar header, then brotli decompression
|
|
84
|
-
* will be attempted.
|
|
85
|
-
*/
|
|
86
|
-
brotli?: boolean | ZlibOptions;
|
|
87
|
-
/**
|
|
88
|
-
* Set to `true` or an object with settings for `zstd.compress()` to
|
|
89
|
-
* create a zstd-compressed archive
|
|
90
|
-
*
|
|
91
|
-
* When extracting, this will cause the archive to be treated as a
|
|
92
|
-
* zstd-compressed file if set to `true` or a ZlibOptions object.
|
|
93
|
-
*
|
|
94
|
-
* If set `false`, then zstd options will not be used.
|
|
95
|
-
*
|
|
96
|
-
* If this, the `gzip`, and `brotli` options are left `undefined`, then tar
|
|
97
|
-
* will attempt to infer the zstd compression status, but can only do so
|
|
98
|
-
* based on the filename. If the filename ends in `.tzst` or `.tar.zst`, and
|
|
99
|
-
* the first 512 bytes are not a valid tar header, then zstd decompression
|
|
100
|
-
* will be attempted.
|
|
101
|
-
*/
|
|
102
|
-
zstd?: boolean | ZlibOptions;
|
|
103
|
-
/**
|
|
104
|
-
* A function that is called with `(path, stat)` when creating an archive, or
|
|
105
|
-
* `(path, entry)` when extracting. Return true to process the file/entry, or
|
|
106
|
-
* false to exclude it.
|
|
107
|
-
*/
|
|
108
|
-
filter?: (path: string, entry: Stats | ReadEntry) => boolean;
|
|
109
|
-
/**
|
|
110
|
-
* A function that gets called for any warning encountered.
|
|
111
|
-
*
|
|
112
|
-
* Note: if `strict` is set, then the warning will throw, and this method
|
|
113
|
-
* will not be called.
|
|
114
|
-
*/
|
|
115
|
-
onwarn?: (code: string, message: string, data: WarnData) => unknown;
|
|
116
|
-
/**
|
|
117
|
-
* The maximum allowed ratio of decompressed bytes to compressed bytes when
|
|
118
|
-
* reading gzip, brotli, or zstd-compressed archives.
|
|
119
|
-
*
|
|
120
|
-
* This defaults to `1000` and aborts extraction or parsing when exceeded.
|
|
121
|
-
* Set to `Infinity` to disable the limit.
|
|
64
|
+
* Called with each entry. A promise is awaited before the next
|
|
65
|
+
* entry.
|
|
122
66
|
*/
|
|
123
|
-
|
|
67
|
+
onEntry?: (entry: ReadEntry) => unknown;
|
|
68
|
+
};
|
|
69
|
+
/** The options of `listSync`. Set `input`, or `file` and `fs`. */
|
|
70
|
+
export type ListOptionsSync = ReadOptionsSync & {
|
|
71
|
+
input?: TarInputSync;
|
|
72
|
+
/** The path of the archive file. */
|
|
73
|
+
file?: string;
|
|
74
|
+
fs?: TarFSSync;
|
|
124
75
|
/**
|
|
125
|
-
*
|
|
126
|
-
*
|
|
127
|
-
* this option, existing hardlinks will be broken, as will any symlink that
|
|
128
|
-
* would affect the location of an extracted file.
|
|
76
|
+
* The most bytes to read from the file at one time. Default, and
|
|
77
|
+
* with 0, 16 MiB. A positive integer, or `Infinity`.
|
|
129
78
|
*/
|
|
130
|
-
|
|
79
|
+
maxReadSize?: number;
|
|
80
|
+
/** Called with each entry. */
|
|
81
|
+
onEntry?: (entry: ReadEntrySync) => unknown;
|
|
82
|
+
};
|
|
83
|
+
/**
|
|
84
|
+
* The options of the extraction that are not about the archive data
|
|
85
|
+
* or the file system functions.
|
|
86
|
+
*/
|
|
87
|
+
export type UnpackOptions = {
|
|
88
|
+
/** The absolute path of the directory to extract into. */
|
|
89
|
+
cwd: string;
|
|
131
90
|
/**
|
|
132
|
-
*
|
|
133
|
-
*
|
|
134
|
-
* extracted
|
|
135
|
-
*
|
|
136
|
-
* Any entry whose entire path is stripped will be excluded.
|
|
91
|
+
* With `'win32'`: the path rules of Windows, the characters `<|>?:`
|
|
92
|
+
* in a name are changed to private-use characters, a file is
|
|
93
|
+
* renamed before it is removed, and one entry is extracted at a
|
|
94
|
+
* time.
|
|
137
95
|
*/
|
|
96
|
+
platform?: 'win32' | 'posix';
|
|
97
|
+
/** Remove this number of leading parts from each path. */
|
|
138
98
|
strip?: number;
|
|
139
99
|
/**
|
|
140
|
-
*
|
|
141
|
-
*
|
|
100
|
+
* Permit absolute paths, `..` in paths, and extraction through
|
|
101
|
+
* symbolic links. This is not safe with an archive that is not
|
|
102
|
+
* trusted.
|
|
142
103
|
*/
|
|
143
|
-
|
|
104
|
+
preservePaths?: boolean;
|
|
144
105
|
/**
|
|
145
|
-
*
|
|
106
|
+
* Remove a file before the entry is written, in place of a write
|
|
107
|
+
* into the existing file. Also remove a symbolic link in the path
|
|
108
|
+
* to an entry.
|
|
146
109
|
*/
|
|
110
|
+
unlink?: boolean;
|
|
111
|
+
/** Do not write over an existing file. */
|
|
147
112
|
keep?: boolean;
|
|
113
|
+
/** Do not write over a file that is newer than the entry. */
|
|
114
|
+
newer?: boolean;
|
|
115
|
+
/** Do not set the times of the entries. */
|
|
116
|
+
noMtime?: boolean;
|
|
148
117
|
/**
|
|
149
|
-
*
|
|
150
|
-
*
|
|
151
|
-
* false otherwise.
|
|
152
|
-
*
|
|
153
|
-
* If false, then files and directories will be set with the owner and group
|
|
154
|
-
* of the user running the process. This is similar to `-p` in `tar(1)`, but
|
|
155
|
-
* ACLs and other system-specific data is never unpacked in this
|
|
156
|
-
* implementation, and modes are set by default already.
|
|
118
|
+
* Set the owner of each entry to the `uid` and `gid` in the
|
|
119
|
+
* archive. Default: true if `processUid` is 0 and `uid` is not set.
|
|
157
120
|
*/
|
|
158
121
|
preserveOwner?: boolean;
|
|
159
|
-
/**
|
|
160
|
-
* The maximum depth of subfolders to extract into. This defaults to 1024.
|
|
161
|
-
* Anything deeper than the limit will raise a warning and skip the entry.
|
|
162
|
-
* Set to `Infinity` to remove the limitation.
|
|
163
|
-
*/
|
|
164
|
-
maxDepth?: number;
|
|
165
|
-
/**
|
|
166
|
-
* When extracting, force all created files and directories, and all
|
|
167
|
-
* implicitly created directories, to be owned by the specified user id,
|
|
168
|
-
* regardless of the `uid` field in the archive.
|
|
169
|
-
*
|
|
170
|
-
* Cannot be used along with `preserveOwner`. Requires also setting the `gid`
|
|
171
|
-
* option.
|
|
172
|
-
*/
|
|
122
|
+
/** Set the owner of each entry to this user. Needs `gid`. */
|
|
173
123
|
uid?: number;
|
|
174
|
-
/**
|
|
175
|
-
* When extracting, force all created files and directories, and all
|
|
176
|
-
* implicitly created directories, to be owned by the specified group id,
|
|
177
|
-
* regardless of the `gid` field in the archive.
|
|
178
|
-
*
|
|
179
|
-
* Cannot be used along with `preserveOwner`. Requires also setting the `uid`
|
|
180
|
-
* option.
|
|
181
|
-
*/
|
|
124
|
+
/** Set the owner of each entry to this group. Needs `uid`. */
|
|
182
125
|
gid?: number;
|
|
126
|
+
/** Set the owner of each entry, also when it is the process owner. */
|
|
127
|
+
forceChown?: boolean;
|
|
183
128
|
/**
|
|
184
|
-
*
|
|
185
|
-
*
|
|
186
|
-
* stream's data will be written instead of the contents of the archive
|
|
187
|
-
* entry. If a falsey value is provided, then the entry is written to disk as
|
|
188
|
-
* normal.
|
|
189
|
-
*
|
|
190
|
-
* To exclude items from extraction, use the `filter` option.
|
|
191
|
-
*
|
|
192
|
-
* Note that using an asynchronous stream type with the `transform` option
|
|
193
|
-
* will cause undefined behavior in synchronous extractions.
|
|
194
|
-
* [MiniPass](http://npm.im/minipass)-based streams are designed for this use
|
|
195
|
-
* case.
|
|
196
|
-
*/
|
|
197
|
-
transform?: (entry: ReadEntry) => ReadEntry | null | undefined | false | 0 | '';
|
|
198
|
-
/**
|
|
199
|
-
* Call `chmod()` to ensure that extracted files match the entry's mode
|
|
200
|
-
* field. Without this field set, all mode fields in archive entries are a
|
|
201
|
-
* best effort attempt only.
|
|
202
|
-
*
|
|
203
|
-
* Setting this necessitates a call to the deprecated `process.umask()`
|
|
204
|
-
* method to determine the default umask value, unless a `processUmask`
|
|
205
|
-
* config is provided as well.
|
|
206
|
-
*
|
|
207
|
-
* If not set, tar will attempt to create file system entries with whatever
|
|
208
|
-
* mode is provided, and let the implicit process `umask` apply normally, but
|
|
209
|
-
* if a file already exists to be written to, then its existing mode will not
|
|
210
|
-
* be modified.
|
|
211
|
-
*
|
|
212
|
-
* When setting `chmod: true`, it is highly recommend to set the
|
|
213
|
-
* {@link TarOptions#processUmask} option as well, to avoid the call to the
|
|
214
|
-
* deprecated (and thread-unsafe) `process.umask()` method.
|
|
129
|
+
* Set the mode of each directory with `chmod`, so that the umask of
|
|
130
|
+
* the process does not change it.
|
|
215
131
|
*/
|
|
216
132
|
chmod?: boolean;
|
|
217
133
|
/**
|
|
218
|
-
*
|
|
219
|
-
* provide a value here to avoid having to call the deprecated and
|
|
220
|
-
* thread-unsafe `process.umask()` method.
|
|
221
|
-
*
|
|
222
|
-
* This has no effect with `chmod` is not set to true, as mode values are not
|
|
223
|
-
* set explicitly anyway. If `chmod` is set to `true`, and a value is not
|
|
224
|
-
* provided here, then `process.umask()` must be called, which will result in
|
|
225
|
-
* deprecation warnings.
|
|
226
|
-
*
|
|
227
|
-
* The most common values for this are `0o22` (resulting in directories
|
|
228
|
-
* created with mode `0o755` and files with `0o644` by default) and `0o2`
|
|
229
|
-
* (resulting in directores created with mode `0o775` and files `0o664`, so
|
|
230
|
-
* they are group-writable).
|
|
134
|
+
* The umask of the process. Only used with `chmod`. Default 0o22.
|
|
231
135
|
*/
|
|
232
136
|
processUmask?: number;
|
|
137
|
+
/** The user ID of the process. */
|
|
138
|
+
processUid?: number;
|
|
139
|
+
/** The group ID of the process. */
|
|
140
|
+
processGid?: number;
|
|
141
|
+
/** Sets the default of `dmode` and `fmode`. Default: `processUmask`. */
|
|
142
|
+
umask?: number;
|
|
143
|
+
/** The mode of a directory that has no mode in the archive. */
|
|
144
|
+
dmode?: number;
|
|
145
|
+
/** The mode of a file that has no mode in the archive. */
|
|
146
|
+
fmode?: number;
|
|
233
147
|
/**
|
|
234
|
-
*
|
|
235
|
-
*
|
|
236
|
-
* Set `noResume: true` to suppress this behavior.
|
|
237
|
-
*
|
|
238
|
-
* Note that when this is set, the stream will never complete until the
|
|
239
|
-
* data is consumed somehow.
|
|
240
|
-
*
|
|
241
|
-
* Set automatically in extract operations, since the entry is piped to
|
|
242
|
-
* a file system entry right away. Only relevant when parsing.
|
|
148
|
+
* The most parts that a path or a link target can have. Default
|
|
149
|
+
* 1024. `Infinity` removes the limit.
|
|
243
150
|
*/
|
|
244
|
-
|
|
151
|
+
maxDepth?: number;
|
|
152
|
+
};
|
|
153
|
+
/**
|
|
154
|
+
* The options of `extract`. Set `input`, or `file`. With `file`, the
|
|
155
|
+
* `fs` must also have the functions of `TarFS`.
|
|
156
|
+
*/
|
|
157
|
+
export type ExtractOptions = ReadOptions & UnpackOptions & {
|
|
245
158
|
/**
|
|
246
|
-
*
|
|
247
|
-
*
|
|
159
|
+
* The most bytes to read from the file at one time. Default, and
|
|
160
|
+
* with 0, 16 MiB. A positive integer, or `Infinity`.
|
|
248
161
|
*/
|
|
249
|
-
|
|
162
|
+
maxReadSize?: number;
|
|
250
163
|
/**
|
|
251
|
-
*
|
|
252
|
-
*
|
|
253
|
-
*
|
|
254
|
-
* Important when listing archives synchronously from a file, because there
|
|
255
|
-
* is otherwise no way to interact with the data!
|
|
164
|
+
* Called with each entry before it is extracted. A promise is
|
|
165
|
+
* awaited before the entry is extracted.
|
|
256
166
|
*/
|
|
257
|
-
|
|
167
|
+
onEntry?: (entry: ReadEntry) => unknown;
|
|
258
168
|
/**
|
|
259
|
-
*
|
|
169
|
+
* Return a stream that changes the content of a file entry, or
|
|
170
|
+
* `undefined` to write the content as it is.
|
|
260
171
|
*/
|
|
261
|
-
|
|
172
|
+
transform?: (entry: ReadEntry) => TransformStream<Uint8Array, Uint8Array> | undefined;
|
|
262
173
|
/**
|
|
263
|
-
*
|
|
264
|
-
*
|
|
265
|
-
* `nlink`. Note that `mtime` is still included, because this is necessary
|
|
266
|
-
* for other time-based operations such as `tar.update`. Additionally, `mode`
|
|
267
|
-
* is set to a "reasonable default" for mose unix systems, based on an
|
|
268
|
-
* effective `umask` of `0o22`.
|
|
269
|
-
*
|
|
270
|
-
* This also defaults the `portable` option in the gzip configs when creating
|
|
271
|
-
* a compressed archive, in order to produce deterministic archives that are
|
|
272
|
-
* not operating-system specific.
|
|
174
|
+
* The most entries to extract at one time. Default, and with 0,
|
|
175
|
+
* 16. A positive integer, or `Infinity`.
|
|
273
176
|
*/
|
|
274
|
-
|
|
177
|
+
jobs?: number;
|
|
178
|
+
} & ({
|
|
275
179
|
/**
|
|
276
|
-
*
|
|
277
|
-
*
|
|
278
|
-
* contents as well.
|
|
180
|
+
* The archive data. A chunk must not change after the source
|
|
181
|
+
* gives it.
|
|
279
182
|
*/
|
|
280
|
-
|
|
183
|
+
input: TarInput;
|
|
184
|
+
/** The name of the archive, for warnings. */
|
|
185
|
+
file?: string;
|
|
186
|
+
fs: ExtractFS;
|
|
187
|
+
} | {
|
|
188
|
+
input?: undefined;
|
|
189
|
+
/** The path of the archive file. */
|
|
190
|
+
file: string;
|
|
191
|
+
fs: ExtractFS & TarFS;
|
|
192
|
+
});
|
|
193
|
+
/** The options of `extractSync`. Set `input`, or `file`. */
|
|
194
|
+
export type ExtractOptionsSync = ReadOptionsSync & UnpackOptions & {
|
|
281
195
|
/**
|
|
282
|
-
*
|
|
283
|
-
*
|
|
284
|
-
* values may be interpreted incorrectly.
|
|
196
|
+
* The most bytes to read from the file at one time. Default, and
|
|
197
|
+
* with 0, 16 MiB. A positive integer, or `Infinity`.
|
|
285
198
|
*/
|
|
286
|
-
|
|
199
|
+
maxReadSize?: number;
|
|
200
|
+
/** Called with each entry before it is extracted. */
|
|
201
|
+
onEntry?: (entry: ReadEntrySync) => unknown;
|
|
287
202
|
/**
|
|
288
|
-
*
|
|
289
|
-
*
|
|
290
|
-
*
|
|
291
|
-
* This is useful when creating archives that are intended to be
|
|
292
|
-
* deterministic based on their contents, irrespective of the file's last
|
|
293
|
-
* modification time.
|
|
294
|
-
*
|
|
295
|
-
* Overridden by `noMtime`.
|
|
203
|
+
* Return a function that changes each chunk of the content of a
|
|
204
|
+
* file entry, or `undefined` to write the content as it is.
|
|
296
205
|
*/
|
|
297
|
-
|
|
206
|
+
transform?: (entry: ReadEntrySync) => ((chunk: Uint8Array) => Uint8Array) | undefined;
|
|
207
|
+
} & ({
|
|
208
|
+
input: TarInputSync;
|
|
209
|
+
/** The name of the archive, for warnings. */
|
|
210
|
+
file?: string;
|
|
211
|
+
fs: ExtractFSSync;
|
|
212
|
+
} | {
|
|
213
|
+
input?: undefined;
|
|
214
|
+
/** The path of the archive file. */
|
|
215
|
+
file: string;
|
|
216
|
+
fs: ExtractFSSync & TarFSSync;
|
|
217
|
+
});
|
|
218
|
+
/** The options that `Pack` and `PackSync` share. */
|
|
219
|
+
export type PackOptionsBase<E extends EntryData> = WarnOptions & {
|
|
298
220
|
/**
|
|
299
|
-
*
|
|
221
|
+
* The absolute path of the directory that the paths to add are
|
|
222
|
+
* relative to. A pack needs it, and `fs`, to add a path. A path
|
|
223
|
+
* that is not absolute is a `TypeError`.
|
|
300
224
|
*/
|
|
225
|
+
cwd?: string;
|
|
226
|
+
/** A directory to put before the path of each entry. */
|
|
301
227
|
prefix?: string;
|
|
302
228
|
/**
|
|
303
|
-
*
|
|
304
|
-
*
|
|
305
|
-
*
|
|
306
|
-
*
|
|
307
|
-
* mode status of extracted entries on the filesystem.
|
|
229
|
+
* Leave out the data that is specific to one system: `uid`, `gid`,
|
|
230
|
+
* `uname`, `gname`, `atime`, `ctime`, `dev`, `ino`, `nlink`, and
|
|
231
|
+
* the `mtime` of a directory. Remove the write permission of the
|
|
232
|
+
* group and of others.
|
|
308
233
|
*/
|
|
309
|
-
|
|
234
|
+
portable?: boolean;
|
|
235
|
+
/** Write no PAX header for a field that does not fit the header. */
|
|
236
|
+
noPax?: boolean;
|
|
237
|
+
/** Add the target of a symbolic link, not the link. */
|
|
238
|
+
follow?: boolean;
|
|
239
|
+
/** Add a directory without the entries in it. */
|
|
240
|
+
noDirRecurse?: boolean;
|
|
241
|
+
/** Write no `mtime`. */
|
|
242
|
+
noMtime?: boolean;
|
|
243
|
+
/** The `mtime` of each entry. */
|
|
244
|
+
mtime?: Date;
|
|
245
|
+
/** Keep a root at the start of a path, such as `/`. */
|
|
246
|
+
preservePaths?: boolean;
|
|
310
247
|
/**
|
|
311
|
-
*
|
|
312
|
-
*
|
|
313
|
-
*
|
|
248
|
+
* Called with each path and its `lstat` result (its `stat` result
|
|
249
|
+
* with `follow`), and with each entry of another archive. If it
|
|
250
|
+
* returns false, the path or the entry is not added.
|
|
314
251
|
*/
|
|
315
|
-
|
|
252
|
+
filter?: (path: string, entry: CreateStats | E) => boolean;
|
|
316
253
|
/**
|
|
317
|
-
*
|
|
318
|
-
*
|
|
319
|
-
*
|
|
254
|
+
* The most bytes to read from a file at one time. Default, and
|
|
255
|
+
* with 0, 16 MiB. A positive integer, or `Infinity`. A larger file
|
|
256
|
+
* is not read before the pack comes to it.
|
|
320
257
|
*/
|
|
321
258
|
maxReadSize?: number;
|
|
322
259
|
/**
|
|
323
|
-
*
|
|
324
|
-
*
|
|
325
|
-
* @internal
|
|
326
|
-
*/
|
|
327
|
-
umask?: number;
|
|
328
|
-
/**
|
|
329
|
-
* Default mode for directories. Used for all implicitly created directories,
|
|
330
|
-
* and any directories in the archive that do not have a mode field.
|
|
331
|
-
*
|
|
332
|
-
* @internal
|
|
260
|
+
* With `'win32'`, each `\` in a path is changed to `/`, and the
|
|
261
|
+
* characters that `winchars` encodes are decoded.
|
|
333
262
|
*/
|
|
334
|
-
|
|
335
|
-
/**
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
*/
|
|
340
|
-
fmode?: number;
|
|
341
|
-
/**
|
|
342
|
-
* Map that tracks which directories already exist, for extraction
|
|
343
|
-
*
|
|
344
|
-
* @internal
|
|
345
|
-
*/
|
|
346
|
-
dirCache?: Map<string, boolean>;
|
|
347
|
-
/**
|
|
348
|
-
* maximum supported size of meta entries. Defaults to 1MB
|
|
349
|
-
*
|
|
350
|
-
* @internal
|
|
351
|
-
*/
|
|
352
|
-
maxMetaEntrySize?: number;
|
|
263
|
+
platform?: 'win32' | 'posix';
|
|
264
|
+
/** The user ID of the process. */
|
|
265
|
+
processUid?: number;
|
|
266
|
+
/** The `uname` of each file that `processUid` owns. */
|
|
267
|
+
processUname?: string;
|
|
353
268
|
/**
|
|
354
|
-
*
|
|
355
|
-
*
|
|
356
|
-
* archives.
|
|
357
|
-
*
|
|
358
|
-
* @internal
|
|
269
|
+
* Called with each entry before its header is written. It can
|
|
270
|
+
* change the fields of the entry.
|
|
359
271
|
*/
|
|
360
|
-
|
|
272
|
+
onWriteEntry?: (entry: WriteEntry) => unknown;
|
|
361
273
|
/**
|
|
362
|
-
*
|
|
363
|
-
*
|
|
364
|
-
*
|
|
274
|
+
* Compression formats, before the gzip support of the runtime. The
|
|
275
|
+
* options `gzip`, `brotli`, and `zstd` select the first codec that
|
|
276
|
+
* has that name.
|
|
365
277
|
*/
|
|
366
|
-
|
|
278
|
+
codecs?: Codec[];
|
|
279
|
+
/** Compress with the codec named `gzip`. */
|
|
280
|
+
gzip?: boolean | Record<string, unknown>;
|
|
281
|
+
/** Compress with the codec named `brotli` in `codecs`. */
|
|
282
|
+
brotli?: boolean | Record<string, unknown>;
|
|
283
|
+
/** Compress with the codec named `zstd` in `codecs`. */
|
|
284
|
+
zstd?: boolean | Record<string, unknown>;
|
|
367
285
|
/**
|
|
368
|
-
*
|
|
369
|
-
*
|
|
370
|
-
*
|
|
286
|
+
* Compress with this codec. It does not need to be in `codecs`.
|
|
287
|
+
* With a pair, the second item is given to the `compress` function
|
|
288
|
+
* of the codec.
|
|
371
289
|
*/
|
|
372
|
-
|
|
290
|
+
compress?: Codec | [codec: Codec, options: Record<string, unknown>];
|
|
291
|
+
};
|
|
292
|
+
/** The options of `Pack`. */
|
|
293
|
+
export type PackOptions = PackOptionsBase<ReadEntry> & {
|
|
294
|
+
fs?: CreateFS;
|
|
373
295
|
/**
|
|
374
|
-
*
|
|
375
|
-
*
|
|
376
|
-
*
|
|
377
|
-
*
|
|
378
|
-
* @internal
|
|
296
|
+
* The number of paths at the start of the queue that are read
|
|
297
|
+
* before the pack writes them. Default, and with 0, 4. A positive
|
|
298
|
+
* integer, or `Infinity`.
|
|
379
299
|
*/
|
|
380
300
|
jobs?: number;
|
|
381
|
-
/**
|
|
382
|
-
* Automatically set to true on Windows systems.
|
|
383
|
-
*
|
|
384
|
-
* When extracting, causes behavior where filenames containing `<|>?:`
|
|
385
|
-
* characters are converted to windows-compatible escape sequences in the
|
|
386
|
-
* created filesystem entries.
|
|
387
|
-
*
|
|
388
|
-
* When packing, causes behavior where paths replace `\` with `/`, and
|
|
389
|
-
* filenames containing the windows-compatible escaped forms of `<|>?:` are
|
|
390
|
-
* converted to actual `<|>?:` characters in the archive.
|
|
391
|
-
*
|
|
392
|
-
* @internal
|
|
393
|
-
*/
|
|
394
|
-
win32?: boolean;
|
|
395
|
-
/**
|
|
396
|
-
* For `WriteEntry` objects, the absolute path to the entry on the
|
|
397
|
-
* filesystem. By default, this is `resolve(cwd, entry.path)`, but it can be
|
|
398
|
-
* overridden explicitly.
|
|
399
|
-
*
|
|
400
|
-
* @internal
|
|
401
|
-
*/
|
|
402
|
-
absolute?: string;
|
|
403
|
-
/**
|
|
404
|
-
* Used with Parser stream interface, to attach and take over when the
|
|
405
|
-
* stream is completely parsed. If this is set, then the prefinish,
|
|
406
|
-
* finish, and end events will not fire, and are the responsibility of
|
|
407
|
-
* the ondone method to emit properly.
|
|
408
|
-
*
|
|
409
|
-
* @internal
|
|
410
|
-
*/
|
|
411
|
-
ondone?: () => void;
|
|
412
|
-
/**
|
|
413
|
-
* Mostly for testing, but potentially useful in some cases.
|
|
414
|
-
* Forcibly trigger a chown on every entry, no matter what.
|
|
415
|
-
*/
|
|
416
|
-
forceChown?: boolean;
|
|
417
|
-
/**
|
|
418
|
-
* ambiguous deprecated name for {@link onReadEntry}
|
|
419
|
-
*
|
|
420
|
-
* @deprecated
|
|
421
|
-
*/
|
|
422
|
-
onentry?: (entry: ReadEntry) => unknown;
|
|
423
|
-
}
|
|
424
|
-
export type TarOptionsSync = TarOptions & {
|
|
425
|
-
sync: true;
|
|
426
301
|
};
|
|
427
|
-
|
|
428
|
-
|
|
302
|
+
/** The options of `PackSync`. */
|
|
303
|
+
export type PackOptionsSync = PackOptionsBase<ReadEntrySync> & {
|
|
304
|
+
fs?: CreateFSSync;
|
|
429
305
|
};
|
|
430
|
-
|
|
431
|
-
|
|
306
|
+
/**
|
|
307
|
+
* The options of `create`. With `file`, the archive is written to
|
|
308
|
+
* that path through `fs`.
|
|
309
|
+
*/
|
|
310
|
+
export type CreateOptions = PackOptions & {
|
|
311
|
+
/** The mode of the archive file. Default 0o666. */
|
|
312
|
+
mode?: number;
|
|
432
313
|
};
|
|
433
|
-
|
|
434
|
-
|
|
314
|
+
/** The options of `createSync`. */
|
|
315
|
+
export type CreateOptionsSync = PackOptionsSync & {
|
|
316
|
+
/** The mode of the archive file. Default 0o666. */
|
|
317
|
+
mode?: number;
|
|
435
318
|
};
|
|
436
|
-
|
|
437
|
-
export type
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
export interface TarOptionsWithAliases extends TarOptions {
|
|
442
|
-
/**
|
|
443
|
-
* The effective current working directory for this tar command
|
|
444
|
-
*/
|
|
445
|
-
C?: TarOptions['cwd'];
|
|
446
|
-
/**
|
|
447
|
-
* The tar file to be read and/or written. When this is set, a stream
|
|
448
|
-
* is not returned. Asynchronous commands will return a promise indicating
|
|
449
|
-
* when the operation is completed, and synchronous commands will return
|
|
450
|
-
* immediately.
|
|
451
|
-
*/
|
|
452
|
-
f?: TarOptions['file'];
|
|
453
|
-
/**
|
|
454
|
-
* When creating a tar archive, this can be used to compress it as well.
|
|
455
|
-
* Set to `true` to use the default gzip options, or customize them as
|
|
456
|
-
* needed.
|
|
457
|
-
*
|
|
458
|
-
* When reading, if this is unset, then the compression status will be
|
|
459
|
-
* inferred from the archive data. This is generally best, unless you are
|
|
460
|
-
* sure of the compression settings in use to create the archive, and want to
|
|
461
|
-
* fail if the archive doesn't match expectations.
|
|
462
|
-
*/
|
|
463
|
-
z?: TarOptions['gzip'];
|
|
464
|
-
/**
|
|
465
|
-
* When creating archives, preserve absolute and `..` paths in the archive,
|
|
466
|
-
* rather than sanitizing them under the cwd.
|
|
467
|
-
*
|
|
468
|
-
* When extracting, allow absolute paths, paths containing `..`, and
|
|
469
|
-
* extracting through symbolic links. By default, the root `/` is stripped
|
|
470
|
-
* from absolute paths (eg, turning `/x/y/z` into `x/y/z`), paths containing
|
|
471
|
-
* `..` are not extracted, and any file whose location would be modified by a
|
|
472
|
-
* symbolic link is not extracted.
|
|
473
|
-
*
|
|
474
|
-
* **WARNING** This is almost always unsafe, and must NEVER be used on
|
|
475
|
-
* archives from untrusted sources, such as user input, and every entry must
|
|
476
|
-
* be validated to ensure it is safe to write. Even if the input is not
|
|
477
|
-
* malicious, mistakes can cause a lot of damage!
|
|
478
|
-
*/
|
|
479
|
-
P?: TarOptions['preservePaths'];
|
|
480
|
-
/**
|
|
481
|
-
* When extracting, unlink files before creating them. Without this option,
|
|
482
|
-
* tar overwrites existing files, which preserves existing hardlinks. With
|
|
483
|
-
* this option, existing hardlinks will be broken, as will any symlink that
|
|
484
|
-
* would affect the location of an extracted file.
|
|
485
|
-
*/
|
|
486
|
-
U?: TarOptions['unlink'];
|
|
487
|
-
/**
|
|
488
|
-
* When extracting, strip the specified number of path portions from the
|
|
489
|
-
* entry path. For example, with `{strip: 2}`, the entry `a/b/c/d` would be
|
|
490
|
-
* extracted to `{cwd}/c/d`.
|
|
491
|
-
*/
|
|
492
|
-
'strip-components'?: TarOptions['strip'];
|
|
493
|
-
/**
|
|
494
|
-
* When extracting, strip the specified number of path portions from the
|
|
495
|
-
* entry path. For example, with `{strip: 2}`, the entry `a/b/c/d` would be
|
|
496
|
-
* extracted to `{cwd}/c/d`.
|
|
497
|
-
*/
|
|
498
|
-
stripComponents?: TarOptions['strip'];
|
|
499
|
-
/**
|
|
500
|
-
* When extracting, keep the existing file on disk if it's newer than the
|
|
501
|
-
* file in the archive.
|
|
502
|
-
*/
|
|
503
|
-
'keep-newer'?: TarOptions['newer'];
|
|
504
|
-
/**
|
|
505
|
-
* When extracting, keep the existing file on disk if it's newer than the
|
|
506
|
-
* file in the archive.
|
|
507
|
-
*/
|
|
508
|
-
keepNewer?: TarOptions['newer'];
|
|
509
|
-
/**
|
|
510
|
-
* When extracting, keep the existing file on disk if it's newer than the
|
|
511
|
-
* file in the archive.
|
|
512
|
-
*/
|
|
513
|
-
'keep-newer-files'?: TarOptions['newer'];
|
|
514
|
-
/**
|
|
515
|
-
* When extracting, keep the existing file on disk if it's newer than the
|
|
516
|
-
* file in the archive.
|
|
517
|
-
*/
|
|
518
|
-
keepNewerFiles?: TarOptions['newer'];
|
|
519
|
-
/**
|
|
520
|
-
* When extracting, do not overwrite existing files at all.
|
|
521
|
-
*/
|
|
522
|
-
k?: TarOptions['keep'];
|
|
523
|
-
/**
|
|
524
|
-
* When extracting, do not overwrite existing files at all.
|
|
525
|
-
*/
|
|
526
|
-
'keep-existing'?: TarOptions['keep'];
|
|
527
|
-
/**
|
|
528
|
-
* When extracting, do not overwrite existing files at all.
|
|
529
|
-
*/
|
|
530
|
-
keepExisting?: TarOptions['keep'];
|
|
319
|
+
/** The options of `replace` and `update`. */
|
|
320
|
+
export type ReplaceOptions = CreateOptions & {
|
|
321
|
+
/** The path of the archive file. It is made if it does not exist. */
|
|
322
|
+
file: string;
|
|
323
|
+
fs: ReplaceFS;
|
|
531
324
|
/**
|
|
532
|
-
*
|
|
533
|
-
*
|
|
534
|
-
*
|
|
535
|
-
* When creating archives, do not store the `mtime` value in the entry. Note
|
|
536
|
-
* that this prevents properly using other mtime-based features (such as
|
|
537
|
-
* `tar.update` or the `newer` option) with the resulting archive.
|
|
325
|
+
* Gets the path and the `mtime` of each entry that the archive
|
|
326
|
+
* has. `update` adds a path only if it is newer than the `mtime`
|
|
327
|
+
* here.
|
|
538
328
|
*/
|
|
539
|
-
|
|
329
|
+
mtimeCache?: Map<string, Date>;
|
|
330
|
+
};
|
|
331
|
+
/** The options of `replaceSync` and `updateSync`. */
|
|
332
|
+
export type ReplaceOptionsSync = CreateOptionsSync & {
|
|
333
|
+
/** The path of the archive file. It is made if it does not exist. */
|
|
334
|
+
file: string;
|
|
335
|
+
fs: ReplaceFSSync;
|
|
540
336
|
/**
|
|
541
|
-
*
|
|
542
|
-
*
|
|
543
|
-
*
|
|
544
|
-
* When creating archives, do not store the `mtime` value in the entry. Note
|
|
545
|
-
* that this prevents properly using other mtime-based features (such as
|
|
546
|
-
* `tar.update` or the `newer` option) with the resulting archive.
|
|
337
|
+
* Gets the path and the `mtime` of each entry that the archive
|
|
338
|
+
* has. `updateSync` adds a path only if it is newer than the
|
|
339
|
+
* `mtime` here.
|
|
547
340
|
*/
|
|
548
|
-
|
|
341
|
+
mtimeCache?: Map<string, Date>;
|
|
342
|
+
};
|
|
343
|
+
/** The options of `delete`. */
|
|
344
|
+
export type DeleteOptions = Omit<ReadOptions, 'filter'> & {
|
|
345
|
+
/** The path of the archive file. */
|
|
346
|
+
file: string;
|
|
347
|
+
fs: DeleteFS;
|
|
549
348
|
/**
|
|
550
|
-
*
|
|
551
|
-
*
|
|
552
|
-
* false otherwise.
|
|
553
|
-
*
|
|
554
|
-
* If false, then files and directories will be set with the owner and group
|
|
555
|
-
* of the user running the process. This is similar to `-p` in `tar(1)`, but
|
|
556
|
-
* ACLs and other system-specific data is never unpacked in this
|
|
557
|
-
* implementation, and modes are set by default already.
|
|
349
|
+
* Return true to remove the entry. With a list of paths, an entry
|
|
350
|
+
* is removed only if the list also has it.
|
|
558
351
|
*/
|
|
559
|
-
|
|
352
|
+
filter?: (path: string, entry: ReadEntry) => boolean;
|
|
560
353
|
/**
|
|
561
|
-
*
|
|
354
|
+
* The most bytes to read from the file at one time. Default, and
|
|
355
|
+
* with 0, 16 MiB. A positive integer, or `Infinity`.
|
|
562
356
|
*/
|
|
563
|
-
|
|
357
|
+
maxReadSize?: number;
|
|
358
|
+
};
|
|
359
|
+
/** The options of `deleteSync`. */
|
|
360
|
+
export type DeleteOptionsSync = Omit<ReadOptionsSync, 'filter'> & {
|
|
361
|
+
/** The path of the archive file. */
|
|
362
|
+
file: string;
|
|
363
|
+
fs: DeleteFSSync;
|
|
564
364
|
/**
|
|
565
|
-
*
|
|
365
|
+
* Return true to remove the entry. With a list of paths, an entry
|
|
366
|
+
* is removed only if the list also has it.
|
|
566
367
|
*/
|
|
567
|
-
|
|
368
|
+
filter?: (path: string, entry: ReadEntrySync) => boolean;
|
|
568
369
|
/**
|
|
569
|
-
*
|
|
570
|
-
*
|
|
571
|
-
*
|
|
572
|
-
* @deprecated
|
|
370
|
+
* The most bytes to read from the file at one time. Default, and
|
|
371
|
+
* with 0, 16 MiB. A positive integer, or `Infinity`.
|
|
573
372
|
*/
|
|
574
|
-
|
|
575
|
-
}
|
|
576
|
-
export type TarOptionsWithAliasesSync = TarOptionsWithAliases & {
|
|
577
|
-
sync: true;
|
|
578
|
-
};
|
|
579
|
-
export type TarOptionsWithAliasesAsync = TarOptionsWithAliases & {
|
|
580
|
-
sync?: false;
|
|
581
|
-
};
|
|
582
|
-
export type TarOptionsWithAliasesFile = (TarOptionsWithAliases & {
|
|
583
|
-
file: string;
|
|
584
|
-
}) | (TarOptionsWithAliases & {
|
|
585
|
-
f: string;
|
|
586
|
-
});
|
|
587
|
-
export type TarOptionsWithAliasesSyncFile = TarOptionsWithAliasesSync & TarOptionsWithAliasesFile;
|
|
588
|
-
export type TarOptionsWithAliasesAsyncFile = TarOptionsWithAliasesAsync & TarOptionsWithAliasesFile;
|
|
589
|
-
export type TarOptionsWithAliasesNoFile = TarOptionsWithAliases & {
|
|
590
|
-
f?: undefined;
|
|
591
|
-
file?: undefined;
|
|
373
|
+
maxReadSize?: number;
|
|
592
374
|
};
|
|
593
|
-
export type TarOptionsWithAliasesSyncNoFile = TarOptionsWithAliasesSync & TarOptionsWithAliasesNoFile;
|
|
594
|
-
export type TarOptionsWithAliasesAsyncNoFile = TarOptionsWithAliasesAsync & TarOptionsWithAliasesNoFile;
|
|
595
|
-
export declare const isSyncFile: <O extends TarOptions>(o: O) => o is O & TarOptionsSyncFile;
|
|
596
|
-
export declare const isAsyncFile: <O extends TarOptions>(o: O) => o is O & TarOptionsAsyncFile;
|
|
597
|
-
export declare const isSyncNoFile: <O extends TarOptions>(o: O) => o is O & TarOptionsSyncNoFile;
|
|
598
|
-
export declare const isAsyncNoFile: <O extends TarOptions>(o: O) => o is O & TarOptionsAsyncNoFile;
|
|
599
|
-
export declare const isSync: <O extends TarOptions>(o: O) => o is O & TarOptionsSync;
|
|
600
|
-
export declare const isAsync: <O extends TarOptions>(o: O) => o is O & TarOptionsAsync;
|
|
601
|
-
export declare const isFile: <O extends TarOptions>(o: O) => o is O & TarOptionsFile;
|
|
602
|
-
export declare const isNoFile: <O extends TarOptions>(o: O) => o is O & TarOptionsNoFile;
|
|
603
|
-
export declare const dealias: (opt?: TarOptionsWithAliases) => TarOptions;
|
|
604
375
|
//# sourceMappingURL=options.d.ts.map
|