16 lines
239 B
JavaScript
16 lines
239 B
JavaScript
|
const fs = require("fs");
|
||
|
|
||
|
function isWritable(filePath) {
|
||
|
let fileAccess = false;
|
||
|
try {
|
||
|
fs.closeSync(fs.openSync(filePath, "r+"));
|
||
|
fileAccess = true;
|
||
|
} catch {
|
||
|
}
|
||
|
return fileAccess;
|
||
|
}
|
||
|
|
||
|
module.exports = {
|
||
|
isWritable,
|
||
|
};
|