How to append new content to local text file in Node.js

1 Answer

0 votes
const fs = require('fs')

filename = "info.txt";
fs.appendFile(filename, 'The new text', function (err) {
    if (err) throw err;
    console.log('Append OK');
  }); 
  
  
 
  
/*
run:
  
Append OK
  
*/

 



answered Feb 28, 2020 by avibootz
edited Mar 1, 2020 by avibootz

Related questions

1 answer 163 views
1 answer 241 views
1 answer 175 views
1 answer 231 views
...