busboy and uws.getParts #120
-
Hi just curious, is there a reason why busboy is better than uws.getParts for parsing multipart body? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi @joshxyzhimself The Busboy on the other hand acts as an asynchronous parser which gradually consumes the incoming stream of data and emits events to allow for consumption of multipart fields as they are detected through the body stream. Furthermore, HyperExpress will automatically pause/resume the incoming body stream in-between Multipart events to allow for the user to perform some async processing thus giving the developer most control while being the most memory efficient as data is gradually streamed and only kept If it is being used. |
Beta Was this translation helpful? Give feedback.
Hi @joshxyzhimself The
uWS.getParts()
method requires the full body as aRecognizedString
which would mean that the incoming body has to be fully available in memory for uWS to output the Multipart fields, this is simply inefficient and would in some cases exhaust the memory where large files are being uploaded.Busboy on the other hand acts as an asynchronous parser which gradually consumes the incoming stream of data and emits events to allow for consumption of multipart fields as they are detected through the body stream. Furthermore, HyperExpress will automatically pause/resume the incoming body stream in-between Multipart events to allow for the user to perform some async processing …