I\'m using busboy, writing my uploaded file to a buffer and performing some validation on it (width, height and filesize). I can\'t for the life of me figure out how to abo
The answer is simple one.
// do the required validation like size check etc.
if( size > 500000)
{
self.req.unpipe();
return;
}
The context is this. I see in busboy code that busboy is implemented as WritableStream and underneath uses Dicer module for parsing which is also implemented as WritableStream. Flow is like this:
req stream ==> busboy ==> dicer ==> dicer raises events ==> busboy raises events on file ==> these events are consumed in your code.
To stop this whole flow of code - the above unpipe should do.