@@ -214,7 +214,7 @@ To replicate `tar tf my-tarball.tgz`, do this:
214
214
``` js
215
215
tar .t ({
216
216
file: ' my-tarball.tgz' ,
217
- onentry : entry => { .. do whatever with it .. }
217
+ onReadEntry : entry => { .. do whatever with it .. }
218
218
})
219
219
```
220
220
@@ -225,7 +225,7 @@ const getEntryFilenames = async tarballFilename => {
225
225
const filenames = []
226
226
await tar .t ({
227
227
file: tarballFilename,
228
- onentry : entry => filenames .push (entry .path ),
228
+ onReadEntry : entry => filenames .push (entry .path ),
229
229
})
230
230
return filenames
231
231
}
@@ -250,7 +250,7 @@ const getEntryFilenamesSync = tarballFilename => {
250
250
const filenames = []
251
251
tar .t ({
252
252
file: tarballFilename,
253
- onentry : entry => filenames .push (entry .path ),
253
+ onReadEntry : entry => filenames .push (entry .path ),
254
254
sync: true ,
255
255
})
256
256
return filenames
@@ -335,6 +335,9 @@ The following options are supported:
335
335
[ Alias: ` m ` , ` no-mtime ` ]
336
336
- ` mtime ` Set to a ` Date ` object to force a specific ` mtime ` for
337
337
everything added to the archive. Overridden by ` noMtime ` .
338
+ - ` onWriteEntry ` Called with each ` WriteEntry ` or
339
+ ` WriteEntrySync ` that is created in the course of writing the
340
+ archive.
338
341
339
342
The following options are mostly internal, but can be modified in some
340
343
advanced use cases, such as re-using caches between runs.
@@ -427,7 +430,7 @@ The following options are supported:
427
430
the archive entry. If a falsey value is provided, then the entry is
428
431
written to disk as normal. (To exclude items from extraction, use
429
432
the ` filter ` option described above.)
430
- - ` onentry ` A function that gets called with ` (entry) ` for each entry
433
+ - ` onReadEntry ` A function that gets called with ` (entry) ` for each entry
431
434
that passes the filter.
432
435
- ` onwarn ` A function that will get called with ` (code, message, data) ` for
433
436
any warnings encountered. (See "Warnings and Errors")
@@ -478,7 +481,7 @@ entries, use the `tar.Parse` class instead.)
478
481
479
482
If a ` file ` option _ is_ provided, then the return value will be a promise
480
483
that resolves when the file has been fully traversed in async mode, or
481
- ` undefined ` if ` sync: true ` is set. Thus, you _ must_ specify an ` onentry `
484
+ ` undefined ` if ` sync: true ` is set. Thus, you _ must_ specify an ` onReadEntry `
482
485
method in order to do anything useful with the data it parses.
483
486
484
487
The following options are supported:
@@ -493,13 +496,13 @@ The following options are supported:
493
496
- ` filter ` A function that gets called with ` (path, entry) ` for each
494
497
entry being listed. Return ` true ` to emit the entry from the
495
498
archive, or ` false ` to skip it.
496
- - ` onentry ` A function that gets called with ` (entry) ` for each entry
499
+ - ` onReadEntry ` A function that gets called with ` (entry) ` for each entry
497
500
that passes the filter. This is important for when ` file ` is set,
498
501
because there is no other way to do anything useful with this method.
499
502
- ` maxReadSize ` The maximum buffer size for ` fs.read() ` operations.
500
503
Defaults to 16 MB.
501
504
- ` noResume ` By default, ` entry ` streams are resumed immediately after
502
- the call to ` onentry ` . Set ` noResume: true ` to suppress this
505
+ the call to ` onReadEntry ` . Set ` noResume: true ` to suppress this
503
506
behavior. Note that by opting into this, the stream will never
504
507
complete until the entry data is consumed.
505
508
- ` onwarn ` A function that will get called with ` (code, message, data) ` for
@@ -556,6 +559,9 @@ The following options are supported:
556
559
[ Alias: ` m ` , ` no-mtime ` ]
557
560
- ` mtime ` Set to a ` Date ` object to force a specific ` mtime ` for
558
561
everything added to the archive. Overridden by ` noMtime ` .
562
+ - ` onWriteEntry ` Called with each ` WriteEntry ` or
563
+ ` WriteEntrySync ` that is created in the course of writing the
564
+ archive.
559
565
560
566
### tar.r(options, fileList, callback) [ alias: tar.replace]
561
567
@@ -608,10 +614,13 @@ The following options are supported:
608
614
[ Alias: ` m ` , ` no-mtime ` ]
609
615
- ` mtime ` Set to a ` Date ` object to force a specific ` mtime ` for
610
616
everything added to the archive. Overridden by ` noMtime ` .
617
+ - ` onWriteEntry ` Called with each ` WriteEntry ` or
618
+ ` WriteEntrySync ` that is created in the course of writing the
619
+ archive.
611
620
612
621
## Low-Level API
613
622
614
- ### class tar. Pack
623
+ ### class Pack
615
624
616
625
A readable tar stream.
617
626
@@ -640,7 +649,6 @@ The following options are supported:
640
649
default" for most unix systems, based on a ` umask ` value of ` 0o22 ` .
641
650
- ` preservePaths ` Allow absolute paths. By default, ` / ` is stripped
642
651
from absolute paths.
643
-
644
652
- ` linkCache ` A Map object containing the device and inode value for
645
653
any file whose nlink is > 1, to identify hard links.
646
654
- ` statCache ` A Map object that caches calls ` lstat ` .
@@ -661,6 +669,9 @@ The following options are supported:
661
669
` tar.update ` or the ` keepNewer ` option with the resulting tar archive.
662
670
- ` mtime ` Set to a ` Date ` object to force a specific ` mtime ` for
663
671
everything added to the archive. Overridden by ` noMtime ` .
672
+ - ` onWriteEntry ` Called with each ` WriteEntry ` or
673
+ ` WriteEntrySync ` that is created in the course of writing the
674
+ archive.
664
675
665
676
#### add(path)
666
677
@@ -674,11 +685,11 @@ Adds an entry to the archive. Returns true if flushed.
674
685
675
686
Finishes the archive.
676
687
677
- ### class tar.Pack.Sync
688
+ ### class PackSync
678
689
679
- Synchronous version of ` tar. Pack` .
690
+ Synchronous version of ` Pack ` .
680
691
681
- ### class tar. Unpack
692
+ ### class Unpack
682
693
683
694
A writable stream that unpacks a tar archive onto the file system.
684
695
@@ -757,7 +768,7 @@ Most unpack errors will cause a `warn` event to be emitted. If the
757
768
written to disk as normal. (To exclude items from extraction, use
758
769
the ` filter ` option described above.)
759
770
- ` strict ` Treat warnings as crash-worthy errors. Default false.
760
- - ` onentry ` A function that gets called with ` (entry) ` for each entry
771
+ - ` onReadEntry ` A function that gets called with ` (entry) ` for each entry
761
772
that passes the filter.
762
773
- ` onwarn ` A function that will get called with ` (code, message, data) ` for
763
774
any warnings encountered. (See "Warnings and Errors")
@@ -775,9 +786,9 @@ Most unpack errors will cause a `warn` event to be emitted. If the
775
786
warning and skip the entry. Set to ` Infinity ` to remove the
776
787
limitation.
777
788
778
- ### class tar.Unpack.Sync
789
+ ### class UnpackSync
779
790
780
- Synchronous version of ` tar. Unpack` .
791
+ Synchronous version of ` Unpack ` .
781
792
782
793
Note that using an asynchronous stream type with the ` transform `
783
794
option will cause undefined behavior in sync unpack streams.
@@ -810,7 +821,7 @@ The following options are supported:
810
821
- ` filter ` A function that gets called with ` (path, entry) ` for each
811
822
entry being listed. Return ` true ` to emit the entry from the
812
823
archive, or ` false ` to skip it.
813
- - ` onentry ` A function that gets called with ` (entry) ` for each entry
824
+ - ` onReadEntry ` A function that gets called with ` (entry) ` for each entry
814
825
that passes the filter.
815
826
- ` onwarn ` A function that will get called with ` (code, message, data) ` for
816
827
any warnings encountered. (See "Warnings and Errors")
0 commit comments