@umijs/utils 4.0.63 → 4.0.65

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.
@@ -0,0 +1,943 @@
1
+ // Type definitions for tar 6.1
2
+ // Project: https://github.com/npm/node-tar
3
+ // Definitions by: Maxime LUCE <https://github.com/SomaticIT>, Connor Peet <https://github.com/connor4312>
4
+ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
5
+ // TODO: When/if typings for [fstream](https://github.com/npm/fstream) are written, refactor this typing to use it for the various streams.
6
+
7
+ /// <reference types="node" />
8
+
9
+ import stream = require('stream');
10
+ import zlib = require('zlib');
11
+ import MiniPass = require('./minipass');
12
+
13
+ // #region Interfaces
14
+
15
+ export interface HeaderProperties {
16
+ path: string;
17
+ mode?: number | undefined;
18
+ noProprietary?: boolean | undefined;
19
+ uid?: number | undefined;
20
+ gid?: number | undefined;
21
+ size?: number | undefined;
22
+ mtime?: number | undefined;
23
+ type?: string | undefined;
24
+ uname?: string | undefined;
25
+ gname?: string | undefined;
26
+ devmaj?: number | undefined;
27
+ devmin?: number | undefined;
28
+ }
29
+
30
+ export interface ExtractOptions {
31
+ type?: string | undefined;
32
+ Directory?: boolean | undefined;
33
+ path?: string | undefined;
34
+ strip?: number | undefined;
35
+ }
36
+
37
+ export interface ParseStream extends NodeJS.ReadWriteStream {
38
+ position: number;
39
+
40
+ _stream: stream.Stream;
41
+ _ended: boolean;
42
+
43
+ _streamEnd(): void;
44
+ _process(c: Buffer): void;
45
+ _startEntry(c: Buffer): void;
46
+ }
47
+
48
+ export interface PackStream extends NodeJS.ReadWriteStream {
49
+ writable: boolean;
50
+ readable: boolean;
51
+
52
+ _noProprietary: boolean;
53
+ _global: HeaderProperties;
54
+ _buffer: stream.Stream[];
55
+ _currentEntry: any;
56
+ _processing: boolean;
57
+ _pipeRoot: stream.Stream;
58
+ _needDrain: boolean;
59
+ _paused: boolean;
60
+
61
+ addGlobal(props: HeaderProperties): void;
62
+ add(stream: stream.Stream): boolean;
63
+ destroy(): void;
64
+
65
+ _process(): void;
66
+ }
67
+
68
+ // #endregion
69
+
70
+ // #region Enums
71
+
72
+ export interface Fields {
73
+ path: number;
74
+ mode: number;
75
+ uid: number;
76
+ gid: number;
77
+ size: number;
78
+ mtime: number;
79
+ cksum: number;
80
+ type: number;
81
+ linkpath: number;
82
+ ustar: number;
83
+ ustarvar: number;
84
+ uname: number;
85
+ gname: number;
86
+ devmaj: number;
87
+ devmin: number;
88
+ prefix: number;
89
+ fill: number;
90
+ }
91
+
92
+ export type fields = Fields; // alias for backwards compatbility
93
+
94
+ export const fieldSize: number[];
95
+ export const fieldOffs: number[];
96
+ export const fieldEnds: number[];
97
+
98
+ /**
99
+ * Different values of the 'type' field
100
+ * paths match the values of Stats.isX() functions, where appropriate
101
+ */
102
+ export const types: {
103
+ 0: string;
104
+ '\0': string;
105
+ '': string;
106
+ 1: string;
107
+ 2: string;
108
+ 3: string;
109
+ 4: string;
110
+ 5: string;
111
+ 6: string;
112
+ 7: string;
113
+ g: string;
114
+ x: string;
115
+ A: string;
116
+ D: string;
117
+ I: string;
118
+ K: string;
119
+ L: string;
120
+ M: string;
121
+ N: string;
122
+ S: string;
123
+ V: string;
124
+ X: string;
125
+ File: string;
126
+ OldFile: string;
127
+ Link: string;
128
+ SymbolicLick: string;
129
+ CharacterDevice: string;
130
+ BlockDevice: string;
131
+ Directory: string;
132
+ FIFO: string;
133
+ ContiguousFile: string;
134
+ GlobalExtendedHeader: string;
135
+ ExtendedHeader: string;
136
+ SolarisACL: string;
137
+ GNUDumpDir: string;
138
+ INode: string;
139
+ NextFileHasLonLinkPath: string;
140
+ NextFileHasLongPath: string;
141
+ ContinuationFile: string;
142
+ TapeVolumeHeader: string;
143
+ OldExtendedHeader: string;
144
+ };
145
+
146
+ /**
147
+ * Values for the mode field
148
+ */
149
+ export const modes: {
150
+ suid: number;
151
+ sgid: number;
152
+ svtx: number;
153
+ uread: number;
154
+ uwrite: number;
155
+ uexec: number;
156
+ gread: number;
157
+ gwrite: number;
158
+ gexec: number;
159
+ oread: number;
160
+ owrite: number;
161
+ oexec: number;
162
+ };
163
+
164
+ export const numeric: {
165
+ mode: boolean;
166
+ uid: boolean;
167
+ gid: boolean;
168
+ size: boolean;
169
+ mtime: boolean;
170
+ devmaj: boolean;
171
+ devmin: boolean;
172
+ cksum: boolean;
173
+ atime: boolean;
174
+ ctime: boolean;
175
+ dev: boolean;
176
+ ino: boolean;
177
+ nlink: boolean;
178
+ };
179
+
180
+ export const knownExtended: {
181
+ atime: boolean;
182
+ charset: boolean;
183
+ comment: boolean;
184
+ ctime: boolean;
185
+ gid: boolean;
186
+ gname: boolean;
187
+ linkpat: boolean;
188
+ mtime: boolean;
189
+ path: boolean;
190
+ realtime: boolean;
191
+ security: boolean;
192
+ size: boolean;
193
+ uid: boolean;
194
+ uname: boolean;
195
+ };
196
+
197
+ export const headerSize: number;
198
+ export const blockSize: number;
199
+
200
+ export interface ParseOptions {
201
+ strict?: boolean;
202
+ filter?: (path: string, entry: ReadEntry) => boolean;
203
+ onentry?: (entry: ReadEntry) => void;
204
+ onwarn?: (code: string, message: string, data: Buffer) => void;
205
+ }
206
+ /**
207
+ * A writable stream. Write tar data to it and it will emit entry events for each entry parsed from the tarball. This is used by tar.Extract.
208
+ */
209
+ export interface Parse extends ParseStream {
210
+ on(event: 'end' | 'close', listener: () => void): this;
211
+ on(event: 'entry', listener: (entry: ReadEntry) => void): this;
212
+ }
213
+
214
+ export const Parse: {
215
+ new (opt?: ParseOptions): Parse;
216
+ };
217
+ //#endregion
218
+
219
+ //#region Global Methods
220
+
221
+ export interface PackOptions {
222
+ /**
223
+ * A function that will get called with (code, message, data) for any
224
+ * warnings encountered. (See "Warnings and Errors")
225
+ */
226
+ onwarn?(code: string, message: string, data: Buffer): void;
227
+ /**
228
+ * Treat warnings as crash-worthy errors.
229
+ *
230
+ * @default false
231
+ */
232
+ strict?: boolean;
233
+ /**
234
+ * The current working directory for creating the archive.
235
+ *
236
+ * @default process.cwd()
237
+ */
238
+ cwd?: string[];
239
+ /**
240
+ * A path portion to prefix onto the entries in the archive.
241
+ */
242
+ prefix?: string;
243
+ /**
244
+ * Set to any truthy value to create a gzipped archive, or an object with
245
+ * settings for zlib.Gzip()
246
+ */
247
+ gzip?: boolean | zlib.ZlibOptions;
248
+ /**
249
+ * A function that gets called with (path, stat) for each entry being added.
250
+ * Return true to add the entry to the archive, or false to omit it.
251
+ */
252
+ filter?(path: string, stat: FileStat): boolean;
253
+ /**
254
+ * Omit metadata that is system-specific: ctime, atime, uid, gid, uname,
255
+ * gname, dev, ino, and nlink. Note that mtime is still included, because
256
+ * this is necessary for other time-based operations. Additionally, mode is
257
+ * set to a "reasonable default" for most unix systems, based on a umask
258
+ * value of 0o22.
259
+ */
260
+ portable?: boolean;
261
+ /**
262
+ * Allow absolute paths. By default, / is stripped from absolute paths.
263
+ */
264
+ preservePaths?: boolean;
265
+ /**
266
+ * A Map object containing the device and inode value for any file whose
267
+ * nlink is > 1, to identify hard links.
268
+ */
269
+ linkCache?: Map<string, string>;
270
+ /**
271
+ * A Map object that caches calls lstat.
272
+ */
273
+ statCache?: Map<string, string>;
274
+ /**
275
+ * A Map object that caches calls to readdir.
276
+ */
277
+ readdirCache?: Map<string, string>;
278
+ /**
279
+ * A number specifying how many concurrent jobs to run.
280
+ *
281
+ * @default 4
282
+ */
283
+ jobs?: number;
284
+ /**
285
+ * The maximum buffer size for fs.read() operations.
286
+ *
287
+ * @default 16 MB
288
+ */
289
+ maxReadSize?: number;
290
+ /**
291
+ * Do not recursively archive the contents of directories.
292
+ */
293
+ noDirRecurse?: boolean;
294
+ /**
295
+ * Set to true to pack the targets of symbolic links. Without this option,
296
+ * symbolic links are archived as such.
297
+ */
298
+ follow?: boolean;
299
+ /**
300
+ * Suppress pax extended headers. Note that this means that long paths and
301
+ * linkpaths will be truncated, and large or negative numeric values may be
302
+ * interpreted incorrectly.
303
+ */
304
+ noPax?: boolean;
305
+ /**
306
+ * Set to true to omit writing mtime values for entries. Note that this
307
+ * prevents using other mtime-based features like tar.update or the
308
+ * keepNewer option with the resulting tar archive.
309
+ */
310
+ noMtime?: boolean;
311
+ /**
312
+ * Set to a Date object to force a specific mtime for everything added to
313
+ * the archive. Overridden by noMtime.
314
+ */
315
+ mtime?: number;
316
+ }
317
+
318
+ /**
319
+ * Returns a through stream. Use fstream to write files into the pack stream and you will receive tar archive data from the pack stream.
320
+ * This only works with directories, it does not work with individual files.
321
+ * The optional properties object are used to set properties in the tar 'Global Extended Header'.
322
+ */
323
+ export class Pack extends MiniPass {
324
+ linkCache: PackOptions['linkCache'];
325
+ readdirCache: PackOptions['readdirCache'];
326
+ statCache: PackOptions['statCache'];
327
+
328
+ static Sync: typeof PackSync;
329
+
330
+ constructor(opt?: PackOptions);
331
+
332
+ add(path: string): this;
333
+ }
334
+
335
+ declare class PackSync extends Pack {
336
+ constructor(opt: PackOptions);
337
+
338
+ // pause/resume are no-ops in sync streams.
339
+ pause(): void;
340
+ resume(): void;
341
+ }
342
+
343
+ declare class PackJob {
344
+ path: string;
345
+ absolute: string;
346
+ entry: unknown | null;
347
+ stat: unknown | null;
348
+ readdir: unknown | null;
349
+ pending: boolean;
350
+ ignore: boolean;
351
+ piped: boolean;
352
+
353
+ constructor(path?: string, absolute?: string);
354
+ }
355
+
356
+ /**
357
+ * Returns a through stream. Write tar data to the stream and the files in the tarball will be extracted onto the filesystem.
358
+ * options can be:
359
+ * ```
360
+ * {
361
+ * path: '/path/to/extract/tar/into',
362
+ * strip: 0, // how many path segments to strip from the root when extracting
363
+ * }
364
+ * ```
365
+ * options also get passed to the fstream.Writer instance that tar uses internally.
366
+ */
367
+ export function Extract(opts: ExtractOptions | string): ParseStream;
368
+
369
+ export interface FileStat extends stream.Readable, Fields {
370
+ header: HeaderProperties;
371
+ startBlockSize: number;
372
+ blockRemain: number;
373
+ remain: number;
374
+ meta: boolean;
375
+ ignore: boolean;
376
+ size: number;
377
+ }
378
+
379
+ export interface ReadEntry extends MiniPass, HeaderProperties {
380
+ /** The extended metadata object provided to the constructor. */
381
+ extended: any;
382
+ /** The global extended metadata object provided to the constructor. */
383
+ globalExtended: any;
384
+ /** The number of bytes remaining to be written into the stream. */
385
+ remain: number;
386
+ /** The number of 512-byte blocks remaining to be written into the stream. */
387
+ blockRemain: number;
388
+ /** Whether this entry should be ignored. */
389
+ ignore: boolean;
390
+ /**
391
+ * True if this represents metadata about the next entry, false if it
392
+ * represents a filesystem object.
393
+ */
394
+ meta: boolean;
395
+ }
396
+
397
+ export interface CreateOptions {
398
+ /**
399
+ * A function that will get called with (message, data)
400
+ * for any warnings encountered.
401
+ */
402
+ onwarn?(message: string, data: Buffer): void;
403
+
404
+ /**
405
+ * Treat warnings as crash-worthy errors. Default false.
406
+ */
407
+ strict?: boolean | undefined;
408
+
409
+ /**
410
+ * The current working directory for creating the archive. Defaults to process.cwd().
411
+ */
412
+ cwd?: string | undefined;
413
+
414
+ /**
415
+ * Alias for cwd.
416
+ */
417
+ C?: string | undefined;
418
+
419
+ /**
420
+ * Set to any truthy value to create a gzipped archive,
421
+ * or an object with settings for zlib.Gzip()
422
+ */
423
+ gzip?: boolean | zlib.ZlibOptions | undefined;
424
+
425
+ /**
426
+ * Alias for gzip.
427
+ */
428
+ z?: boolean | zlib.ZlibOptions | undefined;
429
+
430
+ /**
431
+ * A function that gets called with (path, stat) for each entry being
432
+ * added. Return true to add the entry to the archive, or false to omit it.
433
+ */
434
+ filter?(path: string, stat: FileStat): boolean;
435
+
436
+ /**
437
+ * Omit metadata that is system-specific: ctime, atime, uid, gid, uname,
438
+ * gname, dev, ino, and nlink. Note that mtime is still included,
439
+ * because this is necessary other time-based operations.
440
+ */
441
+ portable?: boolean | undefined;
442
+
443
+ /**
444
+ * Allow absolute paths. By default, / is stripped from absolute paths.
445
+ */
446
+ preservePaths?: boolean | undefined;
447
+
448
+ /**
449
+ * Alias for presevePaths.
450
+ */
451
+ P?: boolean | undefined;
452
+
453
+ /**
454
+ * The mode to set on the created file archive.
455
+ */
456
+ mode?: number | undefined;
457
+
458
+ /**
459
+ * Do not recursively archive the contents of directories.
460
+ */
461
+ noDirRecurse?: boolean | undefined;
462
+
463
+ /**
464
+ * Set to true to pack the targets of symbolic links. Without this
465
+ * option, symbolic links are archived as such.
466
+ */
467
+ follow?: boolean | undefined;
468
+
469
+ /**
470
+ * Alias for follow.
471
+ */
472
+ L?: boolean | undefined;
473
+
474
+ /**
475
+ * Alias for follow.
476
+ */
477
+ h?: boolean | undefined;
478
+
479
+ /**
480
+ * Suppress pax extended headers. Note that this means that long paths and
481
+ * linkpaths will be truncated, and large or negative numeric values
482
+ * may be interpreted incorrectly.
483
+ */
484
+ noPax?: boolean | undefined;
485
+
486
+ /**
487
+ * A path portion to prefix onto the entries in the archive.
488
+ */
489
+ prefix?: string | undefined;
490
+ }
491
+
492
+ export interface ExtractOptions {
493
+ /**
494
+ * A function that will get called with (message, data)
495
+ * for any warnings encountered.
496
+ */
497
+ onwarn?(message: string, data: Buffer): void;
498
+
499
+ /**
500
+ * Treat warnings as crash-worthy errors. Default false.
501
+ */
502
+ strict?: boolean | undefined;
503
+
504
+ /**
505
+ * Extract files relative to the specified directory. Defaults to
506
+ * process.cwd(). If provided, this must exist and must be a directory.
507
+ */
508
+ cwd?: string | undefined;
509
+
510
+ /**
511
+ * Alias for cwd.
512
+ */
513
+ C?: string | undefined;
514
+
515
+ /**
516
+ * A function that gets called with (path, stat) for each entry being
517
+ * added. Return true to emit the entry from the archive, or false to skip it.
518
+ */
519
+ filter?(path: string, stat: FileStat): boolean;
520
+
521
+ /**
522
+ * Set to true to keep the existing file on disk if it's newer than
523
+ * the file in the archive.
524
+ */
525
+ newer?: boolean | undefined;
526
+
527
+ /**
528
+ * Alias for newer.
529
+ */
530
+ 'keep-newer'?: boolean | undefined;
531
+
532
+ /**
533
+ * Alias for newer.
534
+ */
535
+ 'keep-newer-files'?: boolean | undefined;
536
+
537
+ /**
538
+ * Do not overwrite existing files. In particular, if a file appears more
539
+ * than once in an archive, later copies will not overwrite earlier copies
540
+ */
541
+ keep?: boolean | undefined;
542
+
543
+ /**
544
+ * Alias for keep.
545
+ */
546
+ k?: boolean | undefined;
547
+
548
+ /**
549
+ * Alias for keep.
550
+ */
551
+ 'keep-existing'?: boolean | undefined;
552
+
553
+ /**
554
+ * Unlink files before creating them. Without this option, tar overwrites
555
+ * existing files, which preserves existing hardlinks. With this option,
556
+ * existing hardlinks will be broken, as will any symlink that would
557
+ * affect the location of an extracted file.
558
+ */
559
+ unlink?: boolean | undefined;
560
+
561
+ /**
562
+ * Remove the specified number of leading path elements. Pathnames with
563
+ * fewer elements will be silently skipped. Note that the pathname
564
+ * is edited after applying the filter, but before security checks.
565
+ */
566
+ strip?: number | undefined;
567
+
568
+ /**
569
+ * Alias for strip.
570
+ */
571
+ 'strip-components'?: number | undefined;
572
+
573
+ /**
574
+ * Alias for strip.
575
+ */
576
+ stripComponents?: number | undefined;
577
+
578
+ /**
579
+ * If true, tar will set the uid and gid of extracted entries to the uid
580
+ * and gid fields in the archive. This defaults to true when run as root,
581
+ * and false otherwise. If false, then files and directories will be set
582
+ * with the owner and group of the user running the process. This is
583
+ * similar to -p in tar(1), but ACLs and other system-specific data is
584
+ * never unpacked in this implementation, and modes
585
+ * are set by default already.
586
+ */
587
+ preserveOwner?: boolean | undefined;
588
+
589
+ /**
590
+ * Alias for preserveOwner.
591
+ */
592
+ p?: boolean | undefined;
593
+
594
+ /**
595
+ * Set to a number to force ownership of all extracted files and folders,
596
+ * and all implicitly created directories, to be owned by the specified
597
+ * user id, regardless of the uid field in the archive. Cannot be used
598
+ * along with preserveOwner. Requires also setting a gid option.
599
+ */
600
+ uid?: number | undefined;
601
+
602
+ /**
603
+ * Set to a number to force ownership of all extracted files and folders,
604
+ * and all implicitly created directories, to be owned by the specified
605
+ * group id, regardless of the gid field in the archive. Cannot be used
606
+ * along with preserveOwner. Requires also setting a uid option
607
+ */
608
+ gid?: number | undefined;
609
+
610
+ /**
611
+ * Set to true to omit writing mtime value for extracted entries.
612
+ * [Alias: m, no-mtime]
613
+ */
614
+ noMtime?: boolean | undefined;
615
+ m?: boolean | undefined;
616
+ 'no-mtime'?: boolean | undefined;
617
+
618
+ /**
619
+ * Provide a function that takes an entry object, and returns a stream,
620
+ * or any falsey value. If a stream is provided, then that stream's data
621
+ * will be written instead of the contents of the archive entry. If a
622
+ * falsey value is provided, then the entry is written to disk as normal.
623
+ * (To exclude items from extraction, use the filter option described above.)
624
+ */
625
+ transform?(entry: ReadEntry): NodeJS.WritableStream | undefined | false | null;
626
+
627
+ /**
628
+ * A function that gets called with (entry) for each entry that passes the
629
+ * filter.
630
+ */
631
+ onentry?(entry: ReadEntry): void;
632
+
633
+ /**
634
+ * Set to true to omit calling `fs.chmod()` to ensure that the extracted file
635
+ * matches the entry mode. This also suppresses the call to `process.umask()`
636
+ * to determine the default umask value, since tar will extract with whatever
637
+ * mode is provided, and let the process `umask` apply normally.
638
+ */
639
+ noChmod?: boolean | undefined;
640
+
641
+ // The following options are mostly internal, but can be modified in some
642
+ // advanced use cases, such as re-using caches between runs.
643
+
644
+ /**
645
+ * The maximum buffer size for fs.read() operations (in bytes). Defaults to 16 MB.
646
+ */
647
+ maxReadSize?: number | undefined;
648
+
649
+ /**
650
+ * The maximum size of meta entries that is supported. Defaults to 1 MB.
651
+ */
652
+ maxMetaEntrySize?: number | undefined;
653
+ }
654
+
655
+ export interface ListOptions {
656
+ /**
657
+ * Treat warnings as crash-worthy errors. Default false.
658
+ */
659
+ strict?: boolean | undefined;
660
+
661
+ /**
662
+ * Extract files relative to the specified directory. Defaults to
663
+ * process.cwd(). If provided, this must exist and must be a directory.
664
+ */
665
+ cwd?: string | undefined;
666
+
667
+ /**
668
+ * Alias for cwd.
669
+ */
670
+ C?: string | undefined;
671
+
672
+ /**
673
+ * A function that gets called with (path, stat) for each entry being
674
+ * added. Return true to emit the entry from the archive, or false to skip it.
675
+ */
676
+ filter?(path: string, entry: FileStat): boolean;
677
+
678
+ /**
679
+ * A function that gets called with (entry) for each entry that passes the
680
+ * filter. This is important for when both file and sync are set, because
681
+ * it will be called synchronously.
682
+ */
683
+ onentry?(entry: ReadEntry): void;
684
+
685
+ /**
686
+ * The maximum buffer size for fs.read() operations. Defaults to 16 MB.
687
+ */
688
+ maxReadSize?: number | undefined;
689
+
690
+ /**
691
+ * By default, entry streams are resumed immediately after the call to
692
+ * onentry. Set noResume: true to suppress this behavior. Note that by
693
+ * opting into this, the stream will never complete until the entry
694
+ * data is consumed.
695
+ */
696
+ noResume?: boolean | undefined;
697
+ }
698
+
699
+ export interface ReplaceOptions {
700
+ /**
701
+ * Required. Write the tarball archive to the specified filename.
702
+ */
703
+ file: string;
704
+
705
+ /**
706
+ * Act synchronously. If this is set, then any provided file will be
707
+ * fully written after the call to tar.c.
708
+ */
709
+ sync?: boolean | undefined;
710
+
711
+ /**
712
+ * A function that will get called with (message, data)
713
+ * for any warnings encountered.
714
+ */
715
+ onwarn?(message: string, data: Buffer): void;
716
+
717
+ /**
718
+ * Treat warnings as crash-worthy errors. Default false.
719
+ */
720
+ strict?: boolean | undefined;
721
+
722
+ /**
723
+ * Extract files relative to the specified directory. Defaults to
724
+ * process.cwd(). If provided, this must exist and must be a directory.
725
+ */
726
+ cwd?: string | undefined;
727
+
728
+ /**
729
+ * Alias for cwd.
730
+ */
731
+ C?: string | undefined;
732
+
733
+ /**
734
+ * A path portion to prefix onto the entries in the archive.
735
+ */
736
+ prefix?: string | undefined;
737
+
738
+ /**
739
+ * Set to any truthy value to create a gzipped archive,
740
+ * or an object with settings for zlib.Gzip()
741
+ */
742
+ gzip?: boolean | zlib.ZlibOptions | undefined;
743
+
744
+ /**
745
+ * A function that gets called with (path, stat) for each entry being
746
+ * added. Return true to emit the entry from the archive, or false to skip it.
747
+ */
748
+ filter?(path: string, stat: FileStat): boolean;
749
+
750
+ /**
751
+ * Allow absolute paths. By default, / is stripped from absolute paths.
752
+ */
753
+ preservePaths?: boolean | undefined;
754
+
755
+ /**
756
+ * The maximum buffer size for fs.read() operations. Defaults to 16 MB.
757
+ */
758
+ maxReadSize?: number | undefined;
759
+
760
+ /**
761
+ * Do not recursively archive the contents of directories.
762
+ */
763
+ noDirRecurse?: boolean | undefined;
764
+
765
+ /**
766
+ * Set to true to pack the targets of symbolic links. Without this
767
+ * option, symbolic links are archived as such.
768
+ */
769
+ follow?: boolean | undefined;
770
+
771
+ /**
772
+ * Alias for follow.
773
+ */
774
+ L?: boolean | undefined;
775
+
776
+ /**
777
+ * Alias for follow.
778
+ */
779
+ h?: boolean | undefined;
780
+
781
+ /**
782
+ * uppress pax extended headers. Note that this means that long paths and
783
+ * linkpaths will be truncated, and large or negative numeric values
784
+ * may be interpreted incorrectly.
785
+ */
786
+ noPax?: boolean | undefined;
787
+ }
788
+
789
+ export interface FileOptions {
790
+ /**
791
+ * Uses the given file as the input or output of this function.
792
+ */
793
+ file?: string | undefined;
794
+
795
+ /**
796
+ * Alias for file.
797
+ */
798
+ f?: string | undefined;
799
+ }
800
+
801
+ export type RequiredFileOptions = {
802
+ /**
803
+ * Uses the given file as the input or output of this function.
804
+ */
805
+ file: string;
806
+ } | {
807
+ /**
808
+ * Alias for file.
809
+ */
810
+ f: string;
811
+ };
812
+
813
+ /**
814
+ * Create a tarball archive. The fileList is an array of paths to add to the
815
+ * tarball. Adding a directory also adds its children recursively. An entry in
816
+ * fileList that starts with an @ symbol is a tar archive whose entries will
817
+ * be added. To add a file that starts with @, prepend it with `./`.
818
+ *
819
+ * Archive data may be read from the returned stream.
820
+ */
821
+ export function create(
822
+ options: CreateOptions,
823
+ fileList: ReadonlyArray<string>,
824
+ callback?: (err?: Error) => void,
825
+ ): stream.Readable;
826
+
827
+ /**
828
+ * Create a tarball archive. The fileList is an array of paths to add to the
829
+ * tarball. Adding a directory also adds its children recursively. An entry in
830
+ * fileList that starts with an @ symbol is a tar archive whose entries will
831
+ * be added. To add a file that starts with @, prepend it with `./`.
832
+ */
833
+ export function create(options: CreateOptions & FileOptions, fileList: ReadonlyArray<string>): Promise<void>;
834
+ export function create(options: CreateOptions & FileOptions & { sync: true }, fileList: ReadonlyArray<string>): void;
835
+ export function create(
836
+ options: CreateOptions & FileOptions,
837
+ fileList: ReadonlyArray<string>,
838
+ callback: (err?: Error) => void,
839
+ ): void;
840
+
841
+ /**
842
+ * Alias for create
843
+ */
844
+ export const c: typeof create;
845
+
846
+ /**
847
+ * Extract a tarball archive. The fileList is an array of paths to extract
848
+ * from the tarball. If no paths are provided, then all the entries are
849
+ * extracted. If the archive is gzipped, then tar will detect this and unzip
850
+ * it. Note that all directories that are created will be forced to be
851
+ * writable, readable, and listable by their owner, to avoid cases where a
852
+ * directory prevents extraction of child entries by virtue of its mode. Most
853
+ * extraction errors will cause a warn event to be emitted. If the cwd is
854
+ * missing, or not a directory, then the extraction will fail completely.
855
+ *
856
+ * Archive data should be written to the returned stream.
857
+ */
858
+ export function extract(
859
+ options: ExtractOptions,
860
+ fileList?: ReadonlyArray<string>,
861
+ callback?: (err?: Error) => void,
862
+ ): stream.Writable;
863
+
864
+ /**
865
+ * Extract a tarball archive. The fileList is an array of paths to extract
866
+ * from the tarball. If no paths are provided, then all the entries are
867
+ * extracted. If the archive is gzipped, then tar will detect this and unzip
868
+ * it. Note that all directories that are created will be forced to be
869
+ * writable, readable, and listable by their owner, to avoid cases where a
870
+ * directory prevents extraction of child entries by virtue of its mode. Most
871
+ * extraction errors will cause a warn event to be emitted. If the cwd is
872
+ * missing, or not a directory, then the extraction will fail completely.
873
+ */
874
+ export function extract(options: ExtractOptions & FileOptions, fileList?: ReadonlyArray<string>): Promise<void>;
875
+ export function extract(options: ExtractOptions & FileOptions & { sync: true }, fileList?: ReadonlyArray<string>): void;
876
+ export function extract(
877
+ options: ExtractOptions & FileOptions,
878
+ fileList: ReadonlyArray<string> | undefined,
879
+ callback: (err?: Error) => void,
880
+ ): void;
881
+
882
+ /**
883
+ * Alias for extract
884
+ */
885
+ export const x: typeof extract;
886
+
887
+ /**
888
+ * List the contents of a tarball archive. The fileList is an array of paths
889
+ * to list from the tarball. If no paths are provided, then all the entries
890
+ * are listed. If the archive is gzipped, then tar will detect this and unzip
891
+ * it.
892
+ */
893
+ export function list(options: ListOptions & RequiredFileOptions, fileList?: ReadonlyArray<string>): Promise<void>;
894
+ export function list(options: ListOptions & RequiredFileOptions & { sync: true }, fileList?: ReadonlyArray<string>): void;
895
+ export function list(callback?: (err?: Error) => void): Parse;
896
+ export function list(optionsOrFileList: ListOptions | ReadonlyArray<string>, callback?: (err?: Error) => void): Parse;
897
+ export function list(options: ListOptions, fileList: ReadonlyArray<string>, callback?: (err?: Error) => void): Parse;
898
+
899
+ /**
900
+ * Alias for list
901
+ */
902
+ export const t: typeof list;
903
+
904
+ /**
905
+ * Add files to an existing archive. Because later entries override earlier
906
+ * entries, this effectively replaces any existing entries. The fileList is an
907
+ * array of paths to add to the tarball. Adding a directory also adds its
908
+ * children recursively. An entry in fileList that starts with an @ symbol is
909
+ * a tar archive whose entries will be added. To add a file that
910
+ * starts with @, prepend it with ./.
911
+ */
912
+ export function replace(options: ReplaceOptions, fileList?: ReadonlyArray<string>): Promise<void>;
913
+ export function replace(
914
+ options: ReplaceOptions,
915
+ fileList: ReadonlyArray<string> | undefined,
916
+ callback: (err?: Error) => void,
917
+ ): Promise<void>;
918
+
919
+ /**
920
+ * Alias for replace
921
+ */
922
+ export const r: typeof replace;
923
+
924
+ /**
925
+ * Add files to an archive if they are newer than the entry already in the
926
+ * tarball archive. The fileList is an array of paths to add to the tarball.
927
+ * Adding a directory also adds its children recursively. An entry in fileList
928
+ * that starts with an @ symbol is a tar archive whose entries will be added.
929
+ * To add a file that starts with @, prepend it with ./.
930
+ */
931
+ export function update(options: ReplaceOptions, fileList?: ReadonlyArray<string>): Promise<void>;
932
+ export function update(
933
+ options: ReplaceOptions,
934
+ fileList: ReadonlyArray<string> | undefined,
935
+ callback: (err?: Error) => void,
936
+ ): Promise<void>;
937
+
938
+ /**
939
+ * Alias for update
940
+ */
941
+ export const u: typeof update;
942
+
943
+ export {};