Answers for "write and read from file with nodejs"

17

read file node

// load fs
const fs = require("fs");
// read the file
const content = fs.readFileSync("./my_file.txt");
// print it
console.log(content.toString());
Posted by: Guest on October-11-2020
1

get result and write to file node

const fs = require('fs');

fs.writeFileSync( '/myData.json', JSON.stringify(myData) );
Posted by: Guest on December-29-2021

Code answers related to "write and read from file with nodejs"

Code answers related to "Javascript"

Browse Popular Code Answers by Language