Answers for "check if file is empty javascript fs"

0

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'));
    }
}
Posted by: Guest on May-01-2021

Code answers related to "check if file is empty javascript fs"

Code answers related to "Javascript"

Browse Popular Code Answers by Language