I need to generate a txt file with some information and save it in C: How can I do this using node.js?
I need to generate a txt file with some information and save it in C: How can I do this using node.js?
Using the filesystem API of the NodeJS.
The API has a lot of detail and gives you endless possibilities, read the documentation > for more details.
Remember that permission is required to write to the folder.
A very simple example.
var fs = require('fs');
fs.writeFile("C:\Pasta\meuarquivo.txt", "Hello, txt!", function(erro) {
if(erro) {
throw erro;
}
console.log("Arquivo salvo");
});