busboy icon indicating copy to clipboard operation
busboy copied to clipboard

Filesize limit fails unless is a rounded integer

Open shanehoban opened this issue 3 years ago • 0 comments

Was just using arbitrary values for testing the file size limit and it always had truncate set to false - and the limit event on file was never getting hit. Was very confusing until I rounded the number.

Example that fails:

const bb = Busboy({
  headers: event.node.req.headers,
  limits: {
    fileSize: (0.005 * 1024 * 1024)
  }
})

Example that works:

const bb = Busboy({
  headers: event.node.req.headers,
  limits: {
    fileSize: Math.floor(0.005 * 1024 * 1024)
  }
})

Maybe round this on the busboy end to save morons like me time?

shanehoban avatar Dec 06 '22 20:12 shanehoban