check if a file in empty js code example
Example: check if file is empty javascript fs
if (fs.exists('myfile.txt')) {
if (fs.read('myfile.txt').length === 0) {
console.log("File is Empty")
} else {
return JSON.parse(fs.read('myfile.txt'));
}
}