How do I delete a file with node.js?
I don't see a remove command?
You can call
fs.unlink(path, callback) for Asynchronous unlink(2) or
fs.unlinkSync(path) for Synchronous unlink(2).
path is file-path which you want to remove.
For example we want to remove
discovery.docx file from
c:/book directory. So my file-path is
c:/book/discovery.docx. So code for removing that file will be,
var fs = require('fs'); var filePath = 'c:/book/discovery.docx'; fs.unlinkSync(filePath);