
However, if you aren't accepting files, you can either simply not listen for the 'file' event at all or set limits.files to 0, and any/all files will be automatically skipped (these skipped files will still count towards any configured limits.files and limits.parts limits though). Note: If you listen for this event, you should always consume the stream whether you care about its contents or not (you can simply do stream.resume() if you want to discard/skip the contents), otherwise the 'finish'/ 'close' event will never fire on the busboy parser stream.


MimeType - string - The file's 'Content-Type' value. You are better off generating your own (safe) filenames, or at the very least using a hash of the filename.Įncoding - string - The file's 'Content-Transfer-Encoding' value. WARNING: You should almost never use this value as-is (especially if you are using preservePath: true in your config) as it could contain malicious input. info contains the following properties:įilename - string - If supplied, this contains the file's filename. base64 to raw binary) are done on the file's data. stream is a Readable stream containing the file's data. (Special) Parser stream eventsįile(name, stream, info) - Emitted for each new file found. For example, if the Content-Type in headers is missing entirely, is not a supported type, or is missing the boundary for 'multipart/form-data' requests. This function can throw exceptions if there is something wrong with the values in config. Default: 2000 (same as node's http module). HeaderPairs - integer - For multipart forms, the max number of header key-value pairs to parse.

Parts - integer - For multipart forms, the max number of parts (fields + files). Default: Infinity.įiles - integer - For multipart forms, the max number of file fields. Default: Infinity.įileSize - integer - For multipart forms, the max file size (in bytes). Default: 1048576 (1MB).įields - integer - Max number of non-file fields. Default: 100.įieldSize - integer - Max field value size (in bytes). Valid properties are:įieldNameSize - integer - Max field name size (in bytes). Limits - object - Various limits on incoming data. PreservePath - boolean - If paths in filenames from file parts in a 'multipart/form-data' request shall be preserved. filename) that are not extended parameters (that contain an explicit charset). Default: 'utf8'.ĭefParamCharset - string - For multipart forms, the default character set to use for values of part header parameters (e.g. Default: node's stream.Readable default.ĭefCharset - string - Default character set to use when one isn't defined. Default: node's stream.Writable default.įileHwm - integer - highWaterMark to use for individual file streams. HighWaterMark - integer - highWaterMark to use for the parser stream. Headers - object - These are the HTTP headers of the incoming request, which are used by individual parsers. ( function )(config) - Creates and returns a new Writable form parser stream. createServer ( ( req, res ) => ) API Exports

The points are a summary of how big the community is and how well the package is maintained.Const http = require ( 'http' ) const busboy = require ( 'busboy' ) http. Has more versions, more frequent updates and fewer open pull requests. Has a bigger community of maintainers, more daily downloads, more weekly downloads and more monthly downloads. Has been out there for longer (since 9 years ago), it also Has fewer dependencies and fewer open issues. Has more stars on Github, more followers on Github and more forks. When comparing those packages you notice that Human-friendly and powerful HTTP request library for Node.js. Can be used to submit forms and file uploads to other web applications. Promise based HTTP client for the browser and node.js.Ī streaming parser for HTML form data for node.js.Ī library to create readable "multipart/form-data" streams. In this comparison we will focus on the latest versionsĪxios 1.4.0, body-parser 1.20.2, busboy 1.6.0, form-data 4.0.0 and got 13.0.0. Here we compare between axios, body-parser, busboy, form-data and got.
