let fs = require('fs')
let rs = fs.createReadStream('./b.txt')
let ws = fs.createWriteStream('a.txt', {flags: 'a'}, (err) => {
})
rs.on('open', () => {
console.log('可读流打开')
})
rs.on('close', () => {
console.log('可读流关闭')
ws.close()
})
ws.on('open', () => {
console.log('可写流打开')
})
ws.on('open', () => {
console.log('可写流关闭')
})
rs.on('data', (data) => {
console.log(data)
ws.write(data)
})
node.js 流式读取写入
最新推荐文章于 2023-12-21 11:00:34 发布