# connect-busboy

> Connect middleware for busboy

Latest version **1.0.0** (published 2021-12-20) · 0 weekly downloads

## Install

```sh
npm install connect-busboy
pnpm add connect-busboy
yarn add connect-busboy
bun add connect-busboy
```

## Health

**Score 18/100 (F)** — status: abandoned.

Positive: has types package; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2021-12-20 |
| First published | 2013-09-11 |
| Weekly downloads | 0 |
| TypeScript types | separate (@types/connect-busboy) |
| Module format | CommonJS |
| Node | >=10.16.0 |
| Dependencies | 1 |
| Unpacked size | 4.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 155 |
| Author | Brian White |
| Maintainers | mscdex |
| Keywords | connect, middleware, uploads, forms, multipart, form-data |

## Links

- npm: https://www.npmjs.com/package/connect-busboy
- Repository: https://github.com/mscdex/connect-busboy
- Homepage: https://github.com/mscdex/connect-busboy#readme
- Issues: https://github.com/mscdex/connect-busboy/issues
- npm.io page: https://npm.io/package/connect-busboy

## Dependencies (1)

- [busboy](https://npm.io/package/busboy.md) ^1.0.0

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2021-12-20
- 0.0.3 — 2021-12-20
- 0.0.2 — 2014-10-02
- 0.0.1 — 2013-09-11

## README

Description
===========

Connect middleware for [busboy](https://github.com/mscdex/busboy).


Requirements
============

* [node.js](http://nodejs.org/) -- v10.16.0 or newer


Install
============

    npm install connect-busboy


Example
=======

```js
const busboy = require('connect-busboy');

// Default options, no immediate parsing
app.use(busboy());
// ...
app.use((req, res) => {
  if (req.busboy) {
    req.busboy.on('file', (name, file, info) => {
      // ...
    });
    req.busboy.on('field', (name, value, info) => {
      // ...
    });
    req.pipe(req.busboy);
  }
  // etc ...
});

// Default options, immediately start reading from the request stream and
// parsing
app.use(busboy({ immediate: true }));
// ...
app.use((req, res) => {
  if (req.busboy) {
    req.busboy.on('file', (name, file, info) => {
      // ...
    });
    req.busboy.on('field', (name, value, info) => {
      // ...
    });
  }
  // etc ...
});

// Any valid Busboy options can be passed in also
app.use(busboy({
  highWaterMark: 2 * 1024 * 1024,
  limits: {
    fileSize: 10 * 1024 * 1024,
  }
}));

```

## Troubleshooting

### 'TypeError: Cannot call method 'on' of undefined'

If you find that `req.busboy` is not defined in your code when you expect it to be, check that the following conditions are met. If they are not, `req.busboy` won't be defined:

 1. The request method is not GET or HEAD
 2. The Content-Type header specifies  that is "application/x-www-formurlencoded" or starts with "multipart/*"
 3. The Content-Length header is defined or chunked transfer encoding is in use. *This criteria should be met by all well-behaved HTTP clients and is unlikely the problem*.

---
_Source: https://npm.io/package/connect-busboy · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
