When requesting the length using ctx.length, Koa parses the content length response header using the double tilde operator: https://github.com/koajs/koa/blob/master/lib/response.js#L214 However, this operation also performs a 32-bit conversion, resulting in incorrect and weird results when serving large files. Isn't it therefore better to use the Math.trunc() function instead to parse the content length response header?
When requesting the length using
ctx.length
, Koa parses the content length response header using the double tilde operator: https://github.com/koajs/koa/blob/master/lib/response.js#L214 However, this operation also performs a 32-bit conversion, resulting in incorrect and weird results when serving large files. Isn't it therefore better to use theMath.trunc()
function instead to parse the content length response header?