Skip to content

Commit a0f3543

Browse files
committed
Fix mkdir creation process
1 parent b0bbfa9 commit a0f3543

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ var multer = new Multer({
1414
const destination = join(PATH, 'static');
1515

1616
try {
17-
const stat = await FS.stat(destination);
18-
if (!stat.isDirectory()) {
17+
await FS.stat(destination);
18+
return callback(null, destination);
19+
} catch (error) {
20+
if (error.code === 'ENOENT') {
1921
await FS.mkdir(destination);
2022
return callback(null, destination);
2123
}
2224

23-
return callback(null, destination);
24-
} catch (error) {
2525
return callback(error);
2626
}
2727
},

0 commit comments

Comments
 (0)