nodejs —— 流追加数据
在写入流的文档后添加 ,{ 'flags': 'a' } 即可 :
var fs = require('fs')
var readerStream = fs.createReadStream('t.txt')
// 1,覆盖原来内容
// var writerStream = fs.createWriteStream('pipe.txt')
// 2.原内容后追加
var writeStream = fs.createWriteStream('pipe.txt',{ 'flags': 'a' })
readerStream.pipe(writeStream)
console.log('管道输送完成')