writing fils node code example
Example 1: 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
Example 2: writefile in node js
fs.writeFile('2pac.txt', 'Some other lyric', 'ascii', callback);