Writing content into File in NodeJS
Using NodeJS's filesystem module i.e fs
you can write content into a file using the following code.
var fs = require('fs');
fs.writeFile('/path/to/file/filename.txt', 'File content, This will be written in the file' , function(err) {
if(err) {
console.log(err);
}
console.log('Successfully written the file content');
});
Note: Please replace /path/to/file/filename.txt
with the file you want to create including the path.