File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -197,8 +197,9 @@ export const Utils = {
197197 return withWriteLock ( s , async ( ) => {
198198 const { dir, ext } = parsePath ( s ) ;
199199 let file , path = s , options : any = { } ;
200+ const effectiveDir = dir || process . cwd ( ) ;
200201 if ( ! fileFound ) {
201- await Utils . files . createDir ( dir ) ;
202+ await Utils . files . createDir ( effectiveDir ) ;
202203 }
203204 if ( ! ext && mimeType != null ) {
204205 const extFile = MimeTypeExt [ mimeType ] ;
@@ -216,7 +217,7 @@ export const Utils = {
216217 typeof data === "string" && ( options = { encoding : "utf-8" } ) ;
217218 }
218219 }
219- const tmpPath = join ( dir || tmpdir ( ) , `.~${ randomBytes ( 6 ) . toString ( "hex" ) } .tmp` ) ;
220+ const tmpPath = join ( effectiveDir , `.~${ randomBytes ( 6 ) . toString ( "hex" ) } .tmp` ) ;
220221 try {
221222 if ( withStream ) {
222223 await this . writingStreamFile ( tmpPath , file , options ) ;
You can’t perform that action at this time.
0 commit comments