fs.existsSync(path)
This
function returns true if the path exists, else false.
Find
the below working application.
var fs = require('fs'); var filePath = 'out.txt'; if(fs.existsSync(filePath)){ console.log(`File ${filePath} is already exists`); }else{ console.log(`File ${filePath} is not exists`); }
No comments:
Post a Comment