fix error + format

This commit is contained in:
2025-04-29 00:29:00 +02:00
parent 3307f89d7d
commit 99f1890257
63 changed files with 9380 additions and 7015 deletions
+11 -15
View File
@@ -1,4 +1,4 @@
import {mkdir} from "fs"
import { mkdir } from 'fs'
/**
* makes sure that a given folder exists, if it doesn't it creates one for you
@@ -7,23 +7,19 @@ import {mkdir} from "fs"
* @param {Function} cb callback, gives null if the folder exists, otherwise gives the error
* @return {undefined} see: callback
*/
function ensureExists(path, mask, cb) {
if (typeof mask === 'function') { // Allow the `mask` parameter to be optional
cb = mask;
mask = 0o744;
function ensureExists(path, mask, cb) {
if (typeof mask === 'function') {
// Allow the `mask` parameter to be optional
cb = mask
mask = 0o744
}
mkdir(path, mask, function (err) {
if (err) {
if (err.code === 'EEXIST')
cb(null); // Ignore the error if the folder already exists
else
cb(err); // Something else went wrong
}
else
cb(null); // Successfully created folder
});
cb(null) // Ignore the error if the folder already exists
else cb(err) // Something else went wrong
} else cb(null) // Successfully created folder
})
}
export {
ensureExists
} ;
export { ensureExists }