Advertisement
AnindyaBiswas

write

May 16th, 2023 (edited)
627
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var fs = require('fs');
  2.  
  3. var data = "Hello world!\nThis is text written by NodeJS using fs.writeFile()";
  4.  
  5.  
  6. fs.writeFile("Text.txt", data, function(err){
  7.  
  8.     if(err) throw err;
  9.    
  10.     console.log("File written successfully!");
  11.  
  12.  
  13. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement