Closed hktalent closed 11 months ago
const zlib = require('zlib'); function doPush(res, urlPath,szType = 'application/javascript'){ var o = oPushOpt = { status: 200, // optional method: 'GET', // optional request: { accept: '*/*' }, response: { 'Content-Encoding': 'gzip', 'content-type': szType } }; var stream = res.push(urlPath,o); stream.on('error', function(e) { console.log(e); }); var data = fs.readFileSync(webStaticPath + urlPath,{encoding:"utf-8"}); zlib.gzip(data, (err, compressedData) => { if (err) { return console.error(err); } stream.end(compressedData); }); // stream.end(data); } // 静态资源 var a1 = ["/js/client.min.js", "/js/jquery.js", "/js/RecordRTC.min.js", "/js/adapter-latest.js", "/js/qrcode.min.js", "/js/plyr.js", "/js/html5-qrcode.min.js", "/js/aes.js", "/js/fix.js", "/js/bundle.js"]; for(var i in a1){ doPush(res,a1[i]); }
Error: Stream write aborted node_modules/spdy-transport/lib/spdy-transport/stream.js:140:16 at processTicksAndRejections (node:internal/process/task_queues:77:11) Error: Stream write aborted
Error: Stream write aborted node_modules/spdy-transport/lib/spdy-transport/stream.js:140:16 at processTicksAndRejections (node:internal/process/task_queues:77:11) Error: Stream write aborted