Answers for "what is fs in node js"

11

fs.writefile

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
3

node.js import fs

import fs from "fs";
Posted by: Guest on September-06-2021
1

javascript fs read

fs.readFile('/etc/passwd', (err, data) => {
  if (err) throw err;
  console.log(data);
});
Posted by: Guest on April-17-2020
-2

node fs

JScopieddoneconst fs = require('fs')
Posted by: Guest on August-02-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language