📜  如何追加到节点中的文件? - Javascript代码示例

📅  最后修改于: 2022-03-11 15:03:39.158000             🧑  作者: Mango

代码示例1
// 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');