Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

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
Comment

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
  }
})
Comment

PREVIOUS NEXT
Code Example
Javascript :: padstart and padend javascript 
Javascript :: axios withcredentials 
Javascript :: jquery add element to array 
Javascript :: javascript reload page 
Javascript :: utc to local time javascript 
Javascript :: javascript get random line from text file 
Javascript :: how to disable react in jsx scope eslint 
Javascript :: js check if dom element exists 
Javascript :: text to 64base javascript 
Javascript :: mongoose unique field 
Javascript :: how to run different node app on server different domains 
Javascript :: split date in javascript 
Javascript :: ajax get form data 
Javascript :: Unexpected token a in JSON at position 
Javascript :: newtonsoft.json string to object 
Javascript :: vuejs scroll to top 
Javascript :: allow cors express 
Javascript :: count div class in div jquery 
Javascript :: get content of textarea javascript 
Javascript :: move file from one folder to another in aws s3 nodejs 
Javascript :: js send get method 
Javascript :: close tab using jquery 
Javascript :: isarray 
Javascript :: js click element 
Javascript :: Finding HTML Element by Id 
Javascript :: push items to associative array jquery 
Javascript :: iterate object js 
Javascript :: fs.writefilesync in nodejs 
Javascript :: regex match everything except 
Javascript :: change checkbox jquery alert 
ADD CONTENT
Topic
Content
Source link
Name
8+9 =