摘要:
const fs = require('fs'); let file = fs.createReadStream("filename.js"); file.on("open", function(fd) { console.log("开始读取文件:"); }); file.on("data", function(data) { console.log("读取到数据:"); ... 阅读全文
摘要:
const fs = require('fs'); let file = fs.createReadStream("filenpath.js"); file.pause(); file.on("data", function(data) { console.log("读取到数据:"); console.log(data); }); setTimeout(function() {... 阅读全文
摘要:
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... 阅读全文