@@ -88,7 +88,7 @@ export class WriteEntry
88
88
type ?: EntryTypeName | 'Unsupported'
89
89
linkpath ?: string
90
90
stat ?: Stats
91
- /* c8 ignore start */
91
+ onWriteEntry ?: ( entry : WriteEntry ) => any
92
92
93
93
#hadError: boolean = false
94
94
@@ -109,6 +109,7 @@ export class WriteEntry
109
109
this . mtime = opt . mtime
110
110
this . prefix =
111
111
opt . prefix ? normalizeWindowsPath ( opt . prefix ) : undefined
112
+ this . onWriteEntry = opt . onWriteEntry
112
113
113
114
if ( typeof opt . onwarn === 'function' ) {
114
115
this . on ( 'warn' , opt . onwarn )
@@ -222,6 +223,7 @@ export class WriteEntry
222
223
this . noMtime = true
223
224
}
224
225
226
+ this . onWriteEntry ?.( this )
225
227
this . header = new Header ( {
226
228
path : this [ PREFIX ] ( this . path ) ,
227
229
// only apply the prefix to hard links.
@@ -618,6 +620,7 @@ export class WriteEntryTar
618
620
ctime ?: Date
619
621
linkpath ?: string
620
622
size : number
623
+ onWriteEntry ?: ( entry : WriteEntry ) => any
621
624
622
625
warn ( code : string , message : string | Error , data : WarnData = { } ) {
623
626
return warnMethod ( this , code , message , data )
@@ -634,6 +637,7 @@ export class WriteEntryTar
634
637
this . strict = ! ! opt . strict
635
638
this . noPax = ! ! opt . noPax
636
639
this . noMtime = ! ! opt . noMtime
640
+ this . onWriteEntry = opt . onWriteEntry
637
641
638
642
this . readEntry = readEntry
639
643
const { type } = readEntry
@@ -684,6 +688,7 @@ export class WriteEntryTar
684
688
this . remain = readEntry . size
685
689
this . blockRemain = readEntry . startBlockSize
686
690
691
+ this . onWriteEntry ?.( this as unknown as WriteEntry )
687
692
this . header = new Header ( {
688
693
path : this [ PREFIX ] ( this . path ) ,
689
694
linkpath :
0 commit comments