add fileUnlink sync helper

This commit is contained in:
Konneka 2022-02-17 13:48:38 +03:00
parent 3fa4e575f8
commit 960e73f467
1 changed files with 19 additions and 0 deletions

19
helpers/fileUnlink.js Normal file
View File

@ -0,0 +1,19 @@
import fs from "fs";
const fileUnlink = (filePath) => {
try {
if (fs.existsSync(filePath)) {
fs.unlinkSync(filePath);
return true;
}
} catch (e){
throw e;
}
}
export {
fileUnlink as default,
fileUnlink
}