【发布时间】:2021-12-04 18:50:49
【问题描述】:
我可以使用 nodejs 文件系统读取文件:
const fs = require('fs');
fs.readFile('./assets/test1.txt', (err, data) => {
if(err){
console.log(err)
}
console.log(data.toString())
})
console.log('hello shawn!')
为什么先读console.log('hello shawn!'),然后再读console.log(data.toString())?
文件系统中是否还有其他内容先读取data,然后在下面读取console?
【问题讨论】:
标签: node.js asynchronous filesystems fs