📜  javascript 将结果保存到文件 - Javascript 代码示例

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

代码示例2
// Requiring fs module in which 
// writeFile function is defined. 
const fs = require('fs') 
  
// Data which will write in a file. 
let data = "Learning how to write in a file."
  
// Write data in 'Output.txt' . 
fs.writeFile('Output.txt', data, (err) => { 
      
    // In case of a error throw err. 
    if (err) throw err; 
})