var fs = require("fs");
//创建可读流
var readStream = fs.createReadStream("./capture-1.avi");
//创建可写流
var writeStream = fs.createWriteStream("./04.avi");
//监听数据读取事件
readStream.on("data",function(chunk){
console.log(chunk);
//将数据写入文件中
writeStream.write(chunk);
})
//监听读取完毕
readStream.on("end",function(){
//写入操作结束
writeStream.end();
})
网友评论