Answers for "create txt file and write in fs"

11

Writing files in Node.js

const fs = require('fs');

fs.writeFile("/tmp/test", "Hey there!", function(err) {
    if(err) {
        return console.log(err);
    }
    console.log("The file was saved!");
}); 

// Or
fs.writeFileSync('/tmp/test-sync', 'Hey there!');
Posted by: Guest on August-08-2020
0

save text to file nodejs

fs = require('fs');
fs.writeFile(filename, data, [encoding], [callback])
Posted by: Guest on July-18-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language