@@ -102,10 +102,6 @@ async function myStat(
102102 return await fsp . stat ( filepath )
103103}
104104
105- async function ensureDir ( dir : string ) : Promise < void > {
106- await fsp . mkdir ( dir , { recursive : true } )
107- }
108-
109105function dirProvider ( output : string ) : OutstreamProvider {
110106 return async ( inpath , indir = process . cwd ( ) ) => {
111107 if ( inpath == null || inpath === '-' ) {
@@ -117,7 +113,7 @@ function dirProvider(output: string): OutstreamProvider {
117113 const outpath = path . join ( output , relpath )
118114 const outdir = path . dirname ( outpath )
119115
120- await ensureDir ( outdir )
116+ await fsp . mkdir ( outdir , { recursive : true } )
121117 const [ , stats ] = await tryCatch ( fsp . stat ( outpath ) )
122118 const mtime = stats ?. mtime ?? new Date ( 0 )
123119 const outstream = fs . createWriteStream ( outpath ) as OutStream
@@ -130,7 +126,7 @@ function dirProvider(output: string): OutstreamProvider {
130126}
131127
132128function fileProvider ( output : string ) : OutstreamProvider {
133- const dirExistsP = ensureDir ( path . dirname ( output ) )
129+ const dirExistsP = fsp . mkdir ( path . dirname ( output ) , { recursive : true } )
134130 return async ( _inpath ) => {
135131 await dirExistsP
136132 if ( output === '-' ) return process . stdout as OutStream
0 commit comments