
The first parameter is lacking of a headers-attribute. Busboy expected an Object as first parameters.īusboy expected an options-Object with headers-attribute. HeaderSize - integer - For multipart forms, the max size of a multipart header Default: 81920.īusboy expected an options-Object. HeaderPairs - integer - For multipart forms, the max number of header key=>value pairs to parse Default: 2000 Parts - integer - For multipart forms, the max number of parts (fields + files) (Default: Infinity). Valid properties are:įieldNameSize - integer - Max field name size (in bytes) (Default: 100 bytes).įieldSize - integer - Max field value size (in bytes) (Default: 1 MiB, which is 1024 x 1024 bytes).įields - integer - Max number of non-file fields (Default: Infinity).įileSize - integer - For multipart forms, the max file size (in bytes) (Default: Infinity).įiles - integer - For multipart forms, the max number of file fields (Default: Infinity). Limits - object - Various limits on incoming data. (Default: (fieldName, contentType, fileName) => (contentType = 'application/octet-stream' || fileName != undefined)) text/plain, image/jpeg, application/octet-streamįileName - string The name of a file supplied by the part. It has following parameters:įieldName - string The name of the field.ĬontentType - string The content-type of the part, e.g. IsPartAFile - function - Use this function to override the default file detection functionality. PreservePath - boolean - If paths in the multipart 'filename' field shall be preserved. HighWaterMark - integer - highWaterMark to use for this Busboy instance (Default: WritableStream default).įileHwm - integer - highWaterMark to use for file streams (Default: ReadableStream default).ĭefCharset - string - Default character set to use when one isn't defined (Default: 'utf8'). Headers - object - These are the HTTP headers of the incoming request, which are used by individual parsers.ĪutoDestroy - boolean - Whether this stream should automatically call. The constructor takes the following valid config settings: (constructor)(config) - Creates and returns a new Busboy instance. No more 'file' events will be emitted.įieldsLimit() - Emitted when specified fields limit has been reached. No more 'file' or 'field' events will be emitted.įilesLimit() - Emitted when specified files limit has been reached. PartsLimit() - Emitted when specified parts limit has been reached. The property bytesRead informs about the number of bytes that have been read so far.įield(fieldname, value, fieldnameTruncated, valueTruncated, transferEncoding, mimeType) - Emitted for each new non-file field found.If a configured file size limit was reached, stream will both have a boolean property truncated (best checked at the end of the stream) and emit a 'limit' event to notify you when this happens.However, if you don't care about any incoming files, you can simply not listen for the 'file' event at all and any/all files will be automatically and safely discarded (these discarded files do still count towards files and parts limits). you can simply just do stream.resume() if you want to discard the contents), otherwise the 'finish' event will never fire on the Busboy instance. Note: if you listen for this event, you should always handle the stream no matter if you care about the file contents or not (e.g.mimeType contains the 'Content-Type' value for the file stream. transferEncoding contains the 'Content-Transfer-Encoding' value for the file stream. Example output: // // Listening for requests // Field : value: 'testing! :-)' // Field : value: '9001' // Field : value: 'on' // Done parsing form! APIīusboy is a Writable stream Busboy (special) eventsįile(fieldname, stream, filename, transferEncoding, mimeType) - Emitted for each new file form field found.

#Busboy npm install
Install npm i Parsing (multipart) with default options:Ĭonst busboy = new Busboy() Mean time in nanoseconds (less is since busboy 0.31. This is an officially supported fork by fastify organization of the amazing library originally created by Brian White,Īimed at addressing long-standing issues with it.īenchmark (Mean time for 500 Kb payload, 2000 cycles, 1000 cycle warmup): Library

A Node.js module for parsing incoming HTML form data.
