demo代码
//导入fs模块
const fs=require('fs')
//调用fs.readFile()读取文件
fs.readFile('fs.txt','utf-8',function(err,data){
//打印失败
if(err){
console.log(err);
}else{
console.log(data);
}
})
标签:fs,console,log,err,nodejs,readFile,data,读取
来源: https://blog.csdn.net/weixin_44371237/article/details/123032762