fs.unlinkSync(path)
This
method removes a file or symbolic link asynchronously.
HelloWorld.js
var fs = require('fs'); var fileToRemove = 'input.txt'; if(fs.existsSync(fileToRemove)){ console.log(`Removing the file ${fileToRemove}`) fs.unlinkSync(fileToRemove); }else{ console.log(`File ${fileToRemove} not exists`); }
No comments:
Post a Comment