@@ -88,7 +88,7 @@ export class WriteEntry
8888 type ?: EntryTypeName | 'Unsupported'
8989 linkpath ?: string
9090 stat ?: Stats
91- /* c8 ignore start */
91+ onWriteEntry ?: ( entry : WriteEntry ) => any
9292
9393 #hadError: boolean = false
9494
@@ -109,6 +109,7 @@ export class WriteEntry
109109 this . mtime = opt . mtime
110110 this . prefix =
111111 opt . prefix ? normalizeWindowsPath ( opt . prefix ) : undefined
112+ this . onWriteEntry = opt . onWriteEntry
112113
113114 if ( typeof opt . onwarn === 'function' ) {
114115 this . on ( 'warn' , opt . onwarn )
@@ -222,6 +223,7 @@ export class WriteEntry
222223 this . noMtime = true
223224 }
224225
226+ this . onWriteEntry ?.( this )
225227 this . header = new Header ( {
226228 path : this [ PREFIX ] ( this . path ) ,
227229 // only apply the prefix to hard links.
@@ -618,6 +620,7 @@ export class WriteEntryTar
618620 ctime ?: Date
619621 linkpath ?: string
620622 size : number
623+ onWriteEntry ?: ( entry : WriteEntry ) => any
621624
622625 warn ( code : string , message : string | Error , data : WarnData = { } ) {
623626 return warnMethod ( this , code , message , data )
@@ -634,6 +637,7 @@ export class WriteEntryTar
634637 this . strict = ! ! opt . strict
635638 this . noPax = ! ! opt . noPax
636639 this . noMtime = ! ! opt . noMtime
640+ this . onWriteEntry = opt . onWriteEntry
637641
638642 this . readEntry = readEntry
639643 const { type } = readEntry
@@ -684,6 +688,7 @@ export class WriteEntryTar
684688 this . remain = readEntry . size
685689 this . blockRemain = readEntry . startBlockSize
686690
691+ this . onWriteEntry ?.( this as unknown as WriteEntry )
687692 this . header = new Header ( {
688693 path : this [ PREFIX ] ( this . path ) ,
689694 linkpath :
0 commit comments