Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

How to append to a file in Node?

// Asynchronously:
const fs = require('fs');

fs.appendFile('message.txt', 'data to append', function (err) {
  if (err) throw err;
  console.log('Saved!');
});

// Synchronously:
const fs = require('fs');

fs.appendFileSync('message.txt', 'data to append');
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #How #append #file
ADD COMMENT
Topic
Name
2+3 =