When a file bigger than 4.2GB is served by the proxy following error is thrown:
node:internal/validators:79
throw new ERR_OUT_OF_RANGE(name, `>= ${min} && <= ${max}`, value);
^
RangeError [ERR_OUT_OF_RANGE]: The value of "length" is out of range. It must be >= 0 && <= 4294967296. Received 5_368_709_120
at validateOffset (node:buffer:113:3)
at Function.concat (node:buffer:550:5)
at IncomingMessage.<anonymous> (/Users/thonda/programovani/WORK/other/my-proxy/node_modules/koa-better-http-proxy/app/steps/sendProxyRequest.js:18:42)
at IncomingMessage.emit (node:events:539:35)
at endReadableNT (node:internal/streams/readable:1345:12)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
code: 'ERR_OUT_OF_RANGE'
}
How to reproduce
1) create a file that's bigger than 4.2GB
for example using mkfile command on MacOS
mkfile -n 5g testbigfile.csv
2) create server.js file that will serve the big file
var proxy = require('koa-better-http-proxy');
var Koa = require('koa');
var app = new Koa();
app.use(proxy('http://localhost:3000'));
app.listen(4000);
4) start the servers: node proxy.js and node server.js
5) issue a GET request to the proxy `http://localhost:4000
Error is produced by proxy.js
When a file bigger than 4.2GB is served by the proxy following error is thrown:
How to reproduce
1) create a file that's bigger than 4.2GB for example using mkfile command on MacOS
2) create server.js file that will serve the big file
3) create proxy.js file
4) start the servers:
node proxy.js
andnode server.js
5) issue a GET request to the proxy `http://localhost:4000 Error is produced by proxy.js