var fs = require('fs')
var readStream = fs.createReadStream('qd1.mp4')
var writeStream = fs.createWriteStream('1-qd1.mp4')
readStream.on('data',function (chunk) {
if(writeStream.write(chunk) === false){
console.log('still cached')
readStream.pause();
}
})
readStream.on('end',function () {
writeStream.end()
})
writeStream.on('drain',function () {
console.log('data drains')
readStream.resume()
})
node之文件拷贝
最新推荐文章于 2024-06-10 10:01:08 发布