Skip to content

Commit c3ca8b0

Browse files
author
Andrea Cosentino
committed
fix: writingFile
1 parent 946cdd5 commit c3ca8b0

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/utils/utils.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff 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);

0 commit comments

Comments
 (0)