Answers for "how to right plain text format file in node js"

0

how to right plain text format file in node js

var fs = require('fs')
var logger = fs.createWriteStream('log.txt', {
  flags: 'a' // 'a' means appending (old data will be preserved)
})

logger.write('some data') // append string to your file
logger.write('more data') // again
logger.write('and more') // again
Posted by: Guest on August-09-2020
0

how to right plain text format file in node js

var fs = require('fs')
fs.appendFile('log.txt', 'new data', function (err) {
  if (err) {
    // append failed
  } else {
    // done
  }
})
Posted by: Guest on August-09-2020

Code answers related to "how to right plain text format file in node js"

Code answers related to "Javascript"

Browse Popular Code Answers by Language