@types/tar 1.0.29 → 4.0.3

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.
Files changed (5) hide show
  1. tar/LICENSE +21 -0
  2. tar/README.md +4 -4
  3. tar/index.d.ts +764 -228
  4. tar/package.json +18 -5
  5. tar/types-metadata.json +0 -29
tar/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) Microsoft Corporation. All rights reserved.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE
tar/README.md CHANGED
@@ -5,12 +5,12 @@
5
5
  This package contains type definitions for tar (https://github.com/npm/node-tar).
6
6
 
7
7
  # Details
8
- Files were exported from https://www.github.com/DefinitelyTyped/DefinitelyTyped/tree/master/tar
8
+ Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/tar
9
9
 
10
10
  Additional Details
11
- * Last updated: Tue, 10 Jan 2017 20:55:39 GMT
12
- * Dependencies: stream, node
11
+ * Last updated: Wed, 10 Jul 2019 00:30:51 GMT
12
+ * Dependencies: @types/minipass, @types/node
13
13
  * Global values: none
14
14
 
15
15
  # Credits
16
- These definitions were written by Maxime LUCE <https://github.com/SomaticIT>.
16
+ These definitions were written by Maxime LUCE <https://github.com/SomaticIT>, and Connor Peet <https://github.com/connor4312>.
tar/index.d.ts CHANGED
@@ -1,228 +1,764 @@
1
- // Type definitions for tar v1.0.1
2
- // Project: https://github.com/npm/node-tar
3
- // Definitions by: Maxime LUCE <https://github.com/SomaticIT>
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
-
10
- import stream = require("stream");
11
-
12
- // #region Interfaces
13
-
14
- export interface HeaderProperties {
15
- path?: string;
16
- mode?: number;
17
- noProprietary?: boolean;
18
- uid?: number;
19
- gid?: number;
20
- size?: number;
21
- mtime?: number;
22
- uname?: string;
23
- gname?: string;
24
- devmaj?: number;
25
- devmin?: number;
26
- }
27
-
28
- export interface ExtractOptions {
29
- type?: string;
30
- Directory?: boolean;
31
- path?: string;
32
- strip?: number;
33
- }
34
-
35
- export interface ParseStream extends NodeJS.ReadWriteStream {
36
- position: number;
37
-
38
- _stream: stream.Stream;
39
- _ended: boolean;
40
-
41
- _streamEnd(): void;
42
- _process(c: Buffer): void;
43
- _startEntry(c: Buffer): void;
44
- }
45
-
46
- export interface PackStream extends NodeJS.ReadWriteStream {
47
- writable: boolean;
48
- readable: boolean;
49
-
50
- _noProprietary: boolean;
51
- _global: HeaderProperties;
52
- _buffer: stream.Stream[];
53
- _currentEntry: any;
54
- _processing: boolean;
55
- _pipeRoot: stream.Stream;
56
- _needDrain: boolean;
57
- _paused: boolean;
58
-
59
- addGlobal(props: HeaderProperties): void;
60
- add(stream: stream.Stream): boolean;
61
- destroy(): void;
62
-
63
- _process(): void;
64
- }
65
-
66
- export interface ExtractStream extends ParseStream {
67
- }
68
-
69
- // #endregion
70
-
71
- // #region Enums
72
-
73
- export declare var fields: {
74
- path: number;
75
- mode: number;
76
- uid: number;
77
- gid: number;
78
- size: number;
79
- mtime: number;
80
- cksum: number;
81
- type: number;
82
- linkpath: number;
83
- ustar: number;
84
- ustarvar: number;
85
- uname: number;
86
- gname: number;
87
- devmaj: number;
88
- devmin: number;
89
- prefix: number;
90
- fill: number;
91
- };
92
-
93
- export declare var fieldSize: number[];
94
- export declare var fieldOffs: number[];
95
- export declare var fieldEnds: number[];
96
-
97
- /**
98
- * Different values of the 'type' field
99
- * paths match the values of Stats.isX() functions, where appropriate
100
- */
101
- export declare var types: {
102
- 0: string;
103
- "\0": string;
104
- "": string;
105
- 1: string;
106
- 2: string;
107
- 3: string;
108
- 4: string;
109
- 5: string;
110
- 6: string;
111
- 7: string;
112
- g: string;
113
- x: string;
114
- A: string;
115
- D: string;
116
- I: string;
117
- K: string;
118
- L: string;
119
- M: string;
120
- N: string;
121
- S: string;
122
- V: string;
123
- X: string;
124
- File: string;
125
- OldFile: string;
126
- Link: string;
127
- SymbolicLick: string;
128
- CharacterDevice: string;
129
- BlockDevice: string;
130
- Directory: string;
131
- FIFO: string;
132
- ContiguousFile: string;
133
- GlobalExtendedHeader: string;
134
- ExtendedHeader: string;
135
- SolarisACL: string;
136
- GNUDumpDir: string;
137
- INode: string;
138
- NextFileHasLonLinkPath: string;
139
- NextFileHasLongPath: string;
140
- ContinuationFile: string;
141
- TapeVolumeHeader: string;
142
- OldExtendedHeader: string;
143
- };
144
-
145
- /**
146
- * Values for the mode field
147
- */
148
- export declare var modes: {
149
- suid: number;
150
- sgid: number;
151
- svtx: number;
152
- uread: number;
153
- uwrite: number;
154
- uexec: number;
155
- gread: number;
156
- gwrite: number;
157
- gexec: number;
158
- oread: number;
159
- owrite: number;
160
- oexec: number;
161
- };
162
-
163
- export declare var numeric: {
164
- mode: boolean;
165
- uid: boolean;
166
- gid: boolean;
167
- size: boolean;
168
- mtime: boolean;
169
- devmaj: boolean;
170
- devmin: boolean;
171
- cksum: boolean;
172
- atime: boolean;
173
- ctime: boolean;
174
- dev: boolean;
175
- ino: boolean;
176
- nlink: boolean;
177
- };
178
-
179
- export declare var knownExtended: {
180
- atime: boolean;
181
- charset: boolean;
182
- comment: boolean;
183
- ctime: boolean;
184
- gid: boolean;
185
- gname: boolean;
186
- linkpat: boolean;
187
- mtime: boolean;
188
- path: boolean;
189
- realtime: boolean;
190
- security: boolean;
191
- size: boolean;
192
- uid: boolean;
193
- uname: boolean;
194
- };
195
-
196
- export declare var headerSize: number;
197
- export declare var blockSize: number;
198
-
199
- //#endregion
200
-
201
- //#region Global Methods
202
-
203
- /**
204
- * Returns 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.
205
- */
206
- export declare function Parse(): ParseStream;
207
- /**
208
- * Returns a through stream. Use fstream to write files into the pack stream and you will receive tar archive data from the pack stream.
209
- * This only works with directories, it does not work with individual files.
210
- * The optional properties object are used to set properties in the tar 'Global Extended Header'.
211
- */
212
- export declare function Pack(props?: HeaderProperties): PackStream;
213
- /**
214
- * Returns a through stream. Write tar data to the stream and the files in the tarball will be extracted onto the filesystem.
215
- */
216
- export declare function Extract(path: string): ExtractStream;
217
- /**
218
- * Returns a through stream. Write tar data to the stream and the files in the tarball will be extracted onto the filesystem.
219
- * options can be:
220
- * ```
221
- * {
222
- * path: '/path/to/extract/tar/into',
223
- * strip: 0, // how many path segments to strip from the root when extracting
224
- * }
225
- * ```
226
- * options also get passed to the fstream.Writer instance that tar uses internally.
227
- */
228
- export declare function Extract(opts: ExtractOptions): ExtractStream;
1
+ // Type definitions for tar 4.0
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 events = require('events');
11
+ import zlib = require('zlib');
12
+ import MiniPass = require('minipass');
13
+
14
+ // #region Interfaces
15
+
16
+ export interface HeaderProperties {
17
+ path: string;
18
+ mode?: number;
19
+ noProprietary?: boolean;
20
+ uid?: number;
21
+ gid?: number;
22
+ size?: number;
23
+ mtime?: number;
24
+ type?: string;
25
+ uname?: string;
26
+ gname?: string;
27
+ devmaj?: number;
28
+ devmin?: number;
29
+ }
30
+
31
+ export interface ExtractOptions {
32
+ type?: string;
33
+ Directory?: boolean;
34
+ path?: string;
35
+ strip?: number;
36
+ }
37
+
38
+ export interface ParseStream extends NodeJS.ReadWriteStream {
39
+ position: number;
40
+
41
+ _stream: stream.Stream;
42
+ _ended: boolean;
43
+
44
+ _streamEnd(): void;
45
+ _process(c: Buffer): void;
46
+ _startEntry(c: Buffer): void;
47
+ }
48
+
49
+ export interface PackStream extends NodeJS.ReadWriteStream {
50
+ writable: boolean;
51
+ readable: boolean;
52
+
53
+ _noProprietary: boolean;
54
+ _global: HeaderProperties;
55
+ _buffer: stream.Stream[];
56
+ _currentEntry: any;
57
+ _processing: boolean;
58
+ _pipeRoot: stream.Stream;
59
+ _needDrain: boolean;
60
+ _paused: boolean;
61
+
62
+ addGlobal(props: HeaderProperties): void;
63
+ add(stream: stream.Stream): boolean;
64
+ destroy(): void;
65
+
66
+ _process(): void;
67
+ }
68
+
69
+ // #endregion
70
+
71
+ // #region Enums
72
+
73
+ export interface Fields {
74
+ path: number;
75
+ mode: number;
76
+ uid: number;
77
+ gid: number;
78
+ size: number;
79
+ mtime: number;
80
+ cksum: number;
81
+ type: number;
82
+ linkpath: number;
83
+ ustar: number;
84
+ ustarvar: number;
85
+ uname: number;
86
+ gname: number;
87
+ devmaj: number;
88
+ devmin: number;
89
+ prefix: number;
90
+ fill: number;
91
+ }
92
+
93
+ export type fields = Fields; // alias for backwards compatbility
94
+
95
+ export const fieldSize: number[];
96
+ export const fieldOffs: number[];
97
+ export const fieldEnds: number[];
98
+
99
+ /**
100
+ * Different values of the 'type' field
101
+ * paths match the values of Stats.isX() functions, where appropriate
102
+ */
103
+ export const types: {
104
+ 0: string;
105
+ "\0": string;
106
+ "": string;
107
+ 1: string;
108
+ 2: string;
109
+ 3: string;
110
+ 4: string;
111
+ 5: string;
112
+ 6: string;
113
+ 7: string;
114
+ g: string;
115
+ x: string;
116
+ A: string;
117
+ D: string;
118
+ I: string;
119
+ K: string;
120
+ L: string;
121
+ M: string;
122
+ N: string;
123
+ S: string;
124
+ V: string;
125
+ X: string;
126
+ File: string;
127
+ OldFile: string;
128
+ Link: string;
129
+ SymbolicLick: string;
130
+ CharacterDevice: string;
131
+ BlockDevice: string;
132
+ Directory: string;
133
+ FIFO: string;
134
+ ContiguousFile: string;
135
+ GlobalExtendedHeader: string;
136
+ ExtendedHeader: string;
137
+ SolarisACL: string;
138
+ GNUDumpDir: string;
139
+ INode: string;
140
+ NextFileHasLonLinkPath: string;
141
+ NextFileHasLongPath: string;
142
+ ContinuationFile: string;
143
+ TapeVolumeHeader: string;
144
+ OldExtendedHeader: string;
145
+ };
146
+
147
+ /**
148
+ * Values for the mode field
149
+ */
150
+ export const modes: {
151
+ suid: number;
152
+ sgid: number;
153
+ svtx: number;
154
+ uread: number;
155
+ uwrite: number;
156
+ uexec: number;
157
+ gread: number;
158
+ gwrite: number;
159
+ gexec: number;
160
+ oread: number;
161
+ owrite: number;
162
+ oexec: number;
163
+ };
164
+
165
+ export const numeric: {
166
+ mode: boolean;
167
+ uid: boolean;
168
+ gid: boolean;
169
+ size: boolean;
170
+ mtime: boolean;
171
+ devmaj: boolean;
172
+ devmin: boolean;
173
+ cksum: boolean;
174
+ atime: boolean;
175
+ ctime: boolean;
176
+ dev: boolean;
177
+ ino: boolean;
178
+ nlink: boolean;
179
+ };
180
+
181
+ export const knownExtended: {
182
+ atime: boolean;
183
+ charset: boolean;
184
+ comment: boolean;
185
+ ctime: boolean;
186
+ gid: boolean;
187
+ gname: boolean;
188
+ linkpat: boolean;
189
+ mtime: boolean;
190
+ path: boolean;
191
+ realtime: boolean;
192
+ security: boolean;
193
+ size: boolean;
194
+ uid: boolean;
195
+ uname: boolean;
196
+ };
197
+
198
+ export const headerSize: number;
199
+ export const blockSize: number;
200
+
201
+ //#endregion
202
+
203
+ //#region Global Methods
204
+
205
+ /**
206
+ * Returns 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.
207
+ */
208
+ export function Parse(): ParseStream;
209
+ /**
210
+ * Returns a through stream. Use fstream to write files into the pack stream and you will receive tar archive data from the pack stream.
211
+ * This only works with directories, it does not work with individual files.
212
+ * The optional properties object are used to set properties in the tar 'Global Extended Header'.
213
+ */
214
+ export function Pack(props?: HeaderProperties): PackStream;
215
+
216
+ /**
217
+ * Returns a through stream. Write tar data to the stream and the files in the tarball will be extracted onto the filesystem.
218
+ * options can be:
219
+ * ```
220
+ * {
221
+ * path: '/path/to/extract/tar/into',
222
+ * strip: 0, // how many path segments to strip from the root when extracting
223
+ * }
224
+ * ```
225
+ * options also get passed to the fstream.Writer instance that tar uses internally.
226
+ */
227
+ export function Extract(opts: ExtractOptions | string): ParseStream;
228
+
229
+ export interface FileStat extends stream.Readable, Fields {
230
+ header: HeaderProperties;
231
+ startBlockSize: number;
232
+ blockRemain: number;
233
+ remain: number;
234
+ meta: boolean;
235
+ ignore: boolean;
236
+ size: number;
237
+ }
238
+
239
+ export interface ReadEntry extends MiniPass, HeaderProperties {
240
+ /** The extended metadata object provided to the constructor. */
241
+ extended: any;
242
+ /** The global extended metadata object provided to the constructor. */
243
+ globalExtended: any;
244
+ /** The number of bytes remaining to be written into the stream. */
245
+ remain: number;
246
+ /** The number of 512-byte blocks remaining to be written into the stream. */
247
+ blockRemain: number;
248
+ /** Whether this entry should be ignored. */
249
+ ignore: boolean;
250
+ /**
251
+ * True if this represents metadata about the next entry, false if it
252
+ * represents a filesystem object.
253
+ */
254
+ meta: boolean;
255
+ }
256
+
257
+ export interface CreateOptions {
258
+ /**
259
+ * A function that will get called with (message, data)
260
+ * for any warnings encountered.
261
+ */
262
+ onwarn?(message: string, data: Buffer): void;
263
+
264
+ /**
265
+ * Treat warnings as crash-worthy errors. Default false.
266
+ */
267
+ strict?: boolean;
268
+
269
+ /**
270
+ * The current working directory for creating the archive. Defaults to process.cwd().
271
+ */
272
+ cwd?: string;
273
+
274
+ /**
275
+ * Alias for cwd.
276
+ */
277
+ C?: string;
278
+
279
+ /**
280
+ * Set to any truthy value to create a gzipped archive,
281
+ * or an object with settings for zlib.Gzip()
282
+ */
283
+ gzip?: boolean | zlib.ZlibOptions;
284
+
285
+ /**
286
+ * Alias for gzip.
287
+ */
288
+ z?: boolean | zlib.ZlibOptions;
289
+
290
+ /**
291
+ * A function that gets called with (path, stat) for each entry being
292
+ * added. Return true to add the entry to the archive, or false to omit it.
293
+ */
294
+ filter?(path: string, stat: FileStat): boolean;
295
+
296
+ /**
297
+ * Omit metadata that is system-specific: ctime, atime, uid, gid, uname,
298
+ * gname, dev, ino, and nlink. Note that mtime is still included,
299
+ * because this is necessary other time-based operations.
300
+ */
301
+ portable?: boolean;
302
+
303
+ /**
304
+ * Allow absolute paths. By default, / is stripped from absolute paths.
305
+ */
306
+ preservePaths?: boolean;
307
+
308
+ /**
309
+ * Alias for presevePaths.
310
+ */
311
+ P?: boolean;
312
+
313
+ /**
314
+ * The mode to set on the created file archive.
315
+ */
316
+ mode?: number;
317
+
318
+ /**
319
+ * Do not recursively archive the contents of directories.
320
+ */
321
+ noDirRecurse?: boolean;
322
+
323
+ /**
324
+ * Set to true to pack the targets of symbolic links. Without this
325
+ * option, symbolic links are archived as such.
326
+ */
327
+ follow?: boolean;
328
+
329
+ /**
330
+ * Alias for follow.
331
+ */
332
+ L?: boolean;
333
+
334
+ /**
335
+ * Alias for follow.
336
+ */
337
+ h?: boolean;
338
+
339
+ /**
340
+ * Suppress pax extended headers. Note that this means that long paths and
341
+ * linkpaths will be truncated, and large or negative numeric values
342
+ * may be interpreted incorrectly.
343
+ */
344
+ noPax?: boolean;
345
+
346
+ /**
347
+ * A path portion to prefix onto the entries in the archive.
348
+ */
349
+ prefix?: string;
350
+ }
351
+
352
+ export interface ExtractOptions {
353
+ /**
354
+ * A function that will get called with (message, data)
355
+ * for any warnings encountered.
356
+ */
357
+ onwarn?(message: string, data: Buffer): void;
358
+
359
+ /**
360
+ * Treat warnings as crash-worthy errors. Default false.
361
+ */
362
+ strict?: boolean;
363
+
364
+ /**
365
+ * Extract files relative to the specified directory. Defaults to
366
+ * process.cwd(). If provided, this must exist and must be a directory.
367
+ */
368
+ cwd?: string;
369
+
370
+ /**
371
+ * Alias for cwd.
372
+ */
373
+ C?: string;
374
+
375
+ /**
376
+ * A function that gets called with (path, stat) for each entry being
377
+ * added. Return true to emit the entry from the archive, or false to skip it.
378
+ */
379
+ filter?(path: string, stat: FileStat): boolean;
380
+
381
+ /**
382
+ * Set to true to keep the existing file on disk if it's newer than
383
+ * the file in the archive.
384
+ */
385
+ newer?: boolean;
386
+
387
+ /**
388
+ * Alias for newer.
389
+ */
390
+ 'keep-newer'?: boolean;
391
+
392
+ /**
393
+ * Alias for newer.
394
+ */
395
+ 'keep-newer-files'?: boolean;
396
+
397
+ /**
398
+ * Do not overwrite existing files. In particular, if a file appears more
399
+ * than once in an archive, later copies will not overwrite earlier copies
400
+ */
401
+ keep?: boolean;
402
+
403
+ /**
404
+ * Alias for keep.
405
+ */
406
+ k?: boolean;
407
+
408
+ /**
409
+ * Alias for keep.
410
+ */
411
+ 'keep-existing'?: boolean;
412
+
413
+ /**
414
+ * Unlink files before creating them. Without this option, tar overwrites
415
+ * existing files, which preserves existing hardlinks. With this option,
416
+ * existing hardlinks will be broken, as will any symlink that would
417
+ * affect the location of an extracted file.
418
+ */
419
+ unlink?: boolean;
420
+
421
+ /**
422
+ * Remove the specified number of leading path elements. Pathnames with
423
+ * fewer elements will be silently skipped. Note that the pathname
424
+ * is edited after applying the filter, but before security checks.
425
+ */
426
+ strip?: number;
427
+
428
+ /**
429
+ * Alias for strip.
430
+ */
431
+ 'strip-components'?: number;
432
+
433
+ /**
434
+ * Alias for strip.
435
+ */
436
+ stripComponents?: number;
437
+
438
+ /**
439
+ * If true, tar will set the uid and gid of extracted entries to the uid
440
+ * and gid fields in the archive. This defaults to true when run as root,
441
+ * and false otherwise. If false, then files and directories will be set
442
+ * with the owner and group of the user running the process. This is
443
+ * similar to -p in tar(1), but ACLs and other system-specific data is
444
+ * never unpacked in this implementation, and modes
445
+ * are set by default already.
446
+ */
447
+ preserveOwner?: boolean;
448
+
449
+ /**
450
+ * Alias for preserveOwner.
451
+ */
452
+ p?: boolean;
453
+
454
+ /**
455
+ * Set to a number to force ownership of all extracted files and folders,
456
+ * and all implicitly created directories, to be owned by the specified
457
+ * user id, regardless of the uid field in the archive. Cannot be used
458
+ * along with preserveOwner. Requires also setting a gid option.
459
+ */
460
+ uid?: number;
461
+
462
+ /**
463
+ * Set to a number to force ownership of all extracted files and folders,
464
+ * and all implicitly created directories, to be owned by the specified
465
+ * group id, regardless of the gid field in the archive. Cannot be used
466
+ * along with preserveOwner. Requires also setting a uid option
467
+ */
468
+ gid?: number;
469
+
470
+ /**
471
+ * Set to true to omit writing mtime value for extracted entries.
472
+ * [Alias: m, no-mtime]
473
+ */
474
+ noMtime?: boolean;
475
+ m?: boolean;
476
+ 'no-mtime'?: boolean;
477
+
478
+ /**
479
+ * Provide a function that takes an entry object, and returns a stream,
480
+ * or any falsey value. If a stream is provided, then that stream's data
481
+ * will be written instead of the contents of the archive entry. If a
482
+ * falsey value is provided, then the entry is written to disk as normal.
483
+ * (To exclude items from extraction, use the filter option described above.)
484
+ */
485
+ transform?(entry: ReadEntry): NodeJS.WritableStream | undefined | false | null;
486
+
487
+ /**
488
+ * A function that gets called with (entry) for each entry that passes the
489
+ * filter.
490
+ */
491
+ onentry?(entry: ReadEntry): void;
492
+
493
+ // The following options are mostly internal, but can be modified in some
494
+ // advanced use cases, such as re-using caches between runs.
495
+
496
+ /**
497
+ * The maximum buffer size for fs.read() operations (in bytes). Defaults to 16 MB.
498
+ */
499
+ maxReadSize?: number;
500
+
501
+ /**
502
+ * The maximum size of meta entries that is supported. Defaults to 1 MB.
503
+ */
504
+ maxMetaEntrySize?: number;
505
+ }
506
+
507
+ export interface ListOptions {
508
+ /**
509
+ * Treat warnings as crash-worthy errors. Default false.
510
+ */
511
+ strict?: boolean;
512
+
513
+ /**
514
+ * Extract files relative to the specified directory. Defaults to
515
+ * process.cwd(). If provided, this must exist and must be a directory.
516
+ */
517
+ cwd?: string;
518
+
519
+ /**
520
+ * Alias for cwd.
521
+ */
522
+ C?: string;
523
+
524
+ /**
525
+ * A function that gets called with (path, stat) for each entry being
526
+ * added. Return true to emit the entry from the archive, or false to skip it.
527
+ */
528
+ filter?(path: string, entry: FileStat): boolean;
529
+
530
+ /**
531
+ * A function that gets called with (entry) for each entry that passes the
532
+ * filter. This is important for when both file and sync are set, because
533
+ * it will be called synchronously.
534
+ */
535
+ onentry?(entry: FileStat): void;
536
+
537
+ /**
538
+ * The maximum buffer size for fs.read() operations. Defaults to 16 MB.
539
+ */
540
+ maxReadSize?: number;
541
+
542
+ /**
543
+ * By default, entry streams are resumed immediately after the call to
544
+ * onentry. Set noResume: true to suppress this behavior. Note that by
545
+ * opting into this, the stream will never complete until the entry
546
+ * data is consumed.
547
+ */
548
+ noResume?: boolean;
549
+ }
550
+
551
+ export interface ReplaceOptions {
552
+ /**
553
+ * Required. Write the tarball archive to the specified filename.
554
+ */
555
+ file: string;
556
+
557
+ /**
558
+ * Act synchronously. If this is set, then any provided file will be
559
+ * fully written after the call to tar.c.
560
+ */
561
+ sync?: boolean;
562
+
563
+ /**
564
+ * A function that will get called with (message, data)
565
+ * for any warnings encountered.
566
+ */
567
+ onwarn?(message: string, data: Buffer): void;
568
+
569
+ /**
570
+ * Treat warnings as crash-worthy errors. Default false.
571
+ */
572
+ strict?: boolean;
573
+
574
+ /**
575
+ * Extract files relative to the specified directory. Defaults to
576
+ * process.cwd(). If provided, this must exist and must be a directory.
577
+ */
578
+ cwd?: string;
579
+
580
+ /**
581
+ * Alias for cwd.
582
+ */
583
+ C?: string;
584
+
585
+ /**
586
+ * A path portion to prefix onto the entries in the archive.
587
+ */
588
+ prefix?: string;
589
+
590
+ /**
591
+ * Set to any truthy value to create a gzipped archive,
592
+ * or an object with settings for zlib.Gzip()
593
+ */
594
+ gzip?: boolean | zlib.ZlibOptions;
595
+
596
+ /**
597
+ * A function that gets called with (path, stat) for each entry being
598
+ * added. Return true to emit the entry from the archive, or false to skip it.
599
+ */
600
+ filter?(path: string, stat: FileStat): boolean;
601
+
602
+ /**
603
+ * Allow absolute paths. By default, / is stripped from absolute paths.
604
+ */
605
+ preservePaths?: boolean;
606
+
607
+ /**
608
+ * The maximum buffer size for fs.read() operations. Defaults to 16 MB.
609
+ */
610
+ maxReadSize?: number;
611
+
612
+ /**
613
+ * Do not recursively archive the contents of directories.
614
+ */
615
+ noDirRecurse?: boolean;
616
+
617
+ /**
618
+ * Set to true to pack the targets of symbolic links. Without this
619
+ * option, symbolic links are archived as such.
620
+ */
621
+ follow?: boolean;
622
+
623
+ /**
624
+ * Alias for follow.
625
+ */
626
+ L?: boolean;
627
+
628
+ /**
629
+ * Alias for follow.
630
+ */
631
+ h?: boolean;
632
+
633
+ /**
634
+ * uppress pax extended headers. Note that this means that long paths and
635
+ * linkpaths will be truncated, and large or negative numeric values
636
+ * may be interpreted incorrectly.
637
+ */
638
+ noPax?: boolean;
639
+ }
640
+
641
+ export interface FileOptions {
642
+ /**
643
+ * Uses the given file as the input or output of this function.
644
+ */
645
+ file?: string;
646
+
647
+ /**
648
+ * Alias for file.
649
+ */
650
+ f?: string;
651
+ }
652
+
653
+ /**
654
+ * Create a tarball archive. The fileList is an array of paths to add to the
655
+ * tarball. Adding a directory also adds its children recursively. An entry in
656
+ * fileList that starts with an @ symbol is a tar archive whose entries will
657
+ * be added. To add a file that starts with @, prepend it with `./`.
658
+ *
659
+ * Archive data may be read from the returned stream.
660
+ */
661
+ export function create(options: CreateOptions, fileList: ReadonlyArray<string>, callback?: (err?: Error) => void): stream.Readable;
662
+
663
+ /**
664
+ * Create a tarball archive. The fileList is an array of paths to add to the
665
+ * tarball. Adding a directory also adds its children recursively. An entry in
666
+ * fileList that starts with an @ symbol is a tar archive whose entries will
667
+ * be added. To add a file that starts with @, prepend it with `./`.
668
+ */
669
+ export function create(options: CreateOptions & FileOptions, fileList: ReadonlyArray<string>): Promise<void>;
670
+ export function create(options: CreateOptions & FileOptions & { sync: true }, fileList: ReadonlyArray<string>): void;
671
+ export function create(options: CreateOptions & FileOptions, fileList: ReadonlyArray<string>, callback: (err?: Error) => void): void;
672
+
673
+ /**
674
+ * Alias for create
675
+ */
676
+ export const c: typeof create;
677
+
678
+ /**
679
+ * Extract a tarball archive. The fileList is an array of paths to extract
680
+ * from the tarball. If no paths are provided, then all the entries are
681
+ * extracted. If the archive is gzipped, then tar will detect this and unzip
682
+ * it. Note that all directories that are created will be forced to be
683
+ * writable, readable, and listable by their owner, to avoid cases where a
684
+ * directory prevents extraction of child entries by virtue of its mode. Most
685
+ * extraction errors will cause a warn event to be emitted. If the cwd is
686
+ * missing, or not a directory, then the extraction will fail completely.
687
+ *
688
+ * Archive data should be written to the returned stream.
689
+ */
690
+ export function extract(options: ExtractOptions, fileList?: ReadonlyArray<string>, callback?: (err?: Error) => void): stream.Writable;
691
+
692
+ /**
693
+ * Extract a tarball archive. The fileList is an array of paths to extract
694
+ * from the tarball. If no paths are provided, then all the entries are
695
+ * extracted. If the archive is gzipped, then tar will detect this and unzip
696
+ * it. Note that all directories that are created will be forced to be
697
+ * writable, readable, and listable by their owner, to avoid cases where a
698
+ * directory prevents extraction of child entries by virtue of its mode. Most
699
+ * extraction errors will cause a warn event to be emitted. If the cwd is
700
+ * missing, or not a directory, then the extraction will fail completely.
701
+ */
702
+ export function extract(options: ExtractOptions & FileOptions, fileList?: ReadonlyArray<string>): Promise<void>;
703
+ export function extract(options: ExtractOptions & FileOptions & { sync: true }, fileList?: ReadonlyArray<string>): void;
704
+ export function extract(options: ExtractOptions & FileOptions, fileList: ReadonlyArray<string> | undefined, callback: (err?: Error) => void): void;
705
+
706
+ /**
707
+ * Alias for extract
708
+ */
709
+ export const x: typeof extract;
710
+
711
+ /**
712
+ * List the contents of a tarball archive. The fileList is an array of paths
713
+ * to list from the tarball. If no paths are provided, then all the entries
714
+ * are listed. If the archive is gzipped, then tar will detect this and unzip
715
+ * it.
716
+ *
717
+ * Archive data should be written to the returned stream.
718
+ */
719
+ export function list(options?: ListOptions, fileList?: ReadonlyArray<string>, callback?: (err?: Error) => void): stream.Writable;
720
+
721
+ /**
722
+ * List the contents of a tarball archive. The fileList is an array of paths
723
+ * to list from the tarball. If no paths are provided, then all the entries
724
+ * are listed. If the archive is gzipped, then tar will detect this and unzip
725
+ * it.
726
+ */
727
+ export function list(options: ListOptions & FileOptions, fileList?: ReadonlyArray<string>): Promise<void>;
728
+ export function list(options: ListOptions & FileOptions & { sync: true }, fileList?: ReadonlyArray<string>): void;
729
+
730
+ /**
731
+ * Alias for list
732
+ */
733
+ export const t: typeof list;
734
+
735
+ /**
736
+ * Add files to an existing archive. Because later entries override earlier
737
+ * entries, this effectively replaces any existing entries. The fileList is an
738
+ * array of paths to add to the tarball. Adding a directory also adds its
739
+ * children recursively. An entry in fileList that starts with an @ symbol is
740
+ * a tar archive whose entries will be added. To add a file that
741
+ * starts with @, prepend it with ./.
742
+ */
743
+ export function replace(options: ReplaceOptions, fileList?: ReadonlyArray<string>): Promise<void>;
744
+ export function replace(options: ReplaceOptions, fileList: ReadonlyArray<string> | undefined, callback: (err?: Error) => void): Promise<void>;
745
+
746
+ /**
747
+ * Alias for replace
748
+ */
749
+ export const r: typeof replace;
750
+
751
+ /**
752
+ * Add files to an archive if they are newer than the entry already in the
753
+ * tarball archive. The fileList is an array of paths to add to the tarball.
754
+ * Adding a directory also adds its children recursively. An entry in fileList
755
+ * that starts with an @ symbol is a tar archive whose entries will be added.
756
+ * To add a file that starts with @, prepend it with ./.
757
+ */
758
+ export function update(options: ReplaceOptions, fileList?: ReadonlyArray<string>): Promise<void>;
759
+ export function update(options: ReplaceOptions, fileList: ReadonlyArray<string> | undefined, callback: (err?: Error) => void): Promise<void>;
760
+
761
+ /**
762
+ * Alias for update
763
+ */
764
+ export const u: typeof update;
tar/package.json CHANGED
@@ -1,19 +1,32 @@
1
1
  {
2
2
  "name": "@types/tar",
3
- "version": "1.0.29",
3
+ "version": "4.0.3",
4
4
  "description": "TypeScript definitions for tar",
5
5
  "license": "MIT",
6
- "author": "Maxime LUCE <https://github.com/SomaticIT>",
6
+ "contributors": [
7
+ {
8
+ "name": "Maxime LUCE",
9
+ "url": "https://github.com/SomaticIT",
10
+ "githubUsername": "SomaticIT"
11
+ },
12
+ {
13
+ "name": "Connor Peet",
14
+ "url": "https://github.com/connor4312",
15
+ "githubUsername": "connor4312"
16
+ }
17
+ ],
7
18
  "main": "",
19
+ "types": "index",
8
20
  "repository": {
9
21
  "type": "git",
10
- "url": "https://www.github.com/DefinitelyTyped/DefinitelyTyped.git"
22
+ "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
23
+ "directory": "types/tar"
11
24
  },
12
25
  "scripts": {},
13
26
  "dependencies": {
27
+ "@types/minipass": "*",
14
28
  "@types/node": "*"
15
29
  },
16
- "peerDependencies": {},
17
- "typesPublisherContentHash": "2d5b7ff73d64ddc8ffb5bed5daa75ab8ca76f1337a413abfb72eaf5d44e07816",
30
+ "typesPublisherContentHash": "3153dd22505c6c845ae3b160de2304faee264aedd2b4b10af8894c76a3d80a02",
18
31
  "typeScriptVersion": "2.0"
19
32
  }
tar/types-metadata.json DELETED
@@ -1,29 +0,0 @@
1
- {
2
- "name": "tar",
3
- "libraryName": "tar",
4
- "sourceRepoURL": "https://www.github.com/DefinitelyTyped/DefinitelyTyped",
5
- "data": {
6
- "authors": "Maxime LUCE <https://github.com/SomaticIT>",
7
- "dependencies": {
8
- "stream": "*",
9
- "node": "*"
10
- },
11
- "libraryMajorVersion": 1,
12
- "libraryMinorVersion": 0,
13
- "typeScriptVersion": "2.0",
14
- "libraryName": "tar",
15
- "typingsPackageName": "tar",
16
- "projectName": "https://github.com/npm/node-tar",
17
- "sourceRepoURL": "https://www.github.com/DefinitelyTyped/DefinitelyTyped",
18
- "globals": [],
19
- "declaredModules": [
20
- "tar/."
21
- ],
22
- "files": [
23
- "index.d.ts"
24
- ],
25
- "hasPackageJson": false,
26
- "contentHash": "2d5b7ff73d64ddc8ffb5bed5daa75ab8ca76f1337a413abfb72eaf5d44e07816"
27
- },
28
- "isLatest": true
29
- }