My Node.js web service will accept user uploads. I need to limit maximum number of bytes user can upload. I don't want to rely solely on content-length
header since an invalid value can be provided. Is there a way I can limit request stream length I pipe to disk or db?
I thought about stream.Transform
that will throw an exception if the stream length is longer than content-length
header value. Probably, there is a built-in function?