摘要: const fs = require('fs'); const file = fs.createReadStream("readfile.js"); const outputFile = fs.createWriteStream("outputfile.js"); file.on("data", function(data) { outputFile.write(data); }); o... 阅读全文
posted @ 2017-07-05 17:35 yudis 阅读(483) 评论(0) 推荐(0) 编辑
摘要: const fs = require('fs'); let file = fs.createReadStream("filename.js"); file.on("open", function(fd) { console.log("开始读取文件:"); }); file.on("data", function(data) { console.log("读取到数据:"); ... 阅读全文
posted @ 2017-07-05 17:31 yudis 阅读(1308) 评论(0) 推荐(0) 编辑
摘要: const fs = require('fs'); let file = fs.createReadStream("filenpath.js"); file.pause(); file.on("data", function(data) { console.log("读取到数据:"); console.log(data); }); setTimeout(function() {... 阅读全文
posted @ 2017-07-05 16:09 yudis 阅读(337) 评论(0) 推荐(0) 编辑
摘要: const stream = fs.createReadStream('/example.pdf', {bufferSize: 64 * 1024}) stream.pipe(res); let had_error = false; stream.on('error', function(err){ had_error = true; }); stream.on('close', func... 阅读全文
posted @ 2017-07-05 16:06 yudis 阅读(2304) 评论(0) 推荐(0) 编辑