Answers for "fs read contents of file"

7

nodejs readfile

const fs = require('fs');

fs.readFile('/Users/joe/test.txt', 'utf8' , (err, data) => {
  if (err) {
    console.error(err);
    return
  }
  console.log(data);
});
Posted by: Guest on August-30-2020
0

fs readfile not working

const content = fs.readFileSync('./Index.html', 'utf8');
console.log(content);
Posted by: Guest on September-30-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language