Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: from busboy to @fastify/busboy #302

Merged
merged 1 commit into from
Dec 5, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,11 @@ Fastify plugin to parse the multipart content-type. Supports:
- Mode to attach all fields to the request body
- Tested across Linux/Mac/Windows

Under the hood it uses [busboy](https://github.com/mscdex/busboy).
Under the hood it uses [`@fastify/busboy`](https://github.com/fastify/busboy).

## Install
```sh
npm i fastify-multipart
# Typescript support
npm i -D @types/busboy
npm i --save fastify-multipart
```

## Usage
Expand Down Expand Up @@ -72,10 +70,10 @@ fastify.listen(3000, err => {
})
```

You can also pass optional arguments to busboy when registering with Fastify. This is useful for setting limits on the content that can be uploaded. A full list of available options can be found in the [busboy documentation](https://github.com/mscdex/busboy#busboy-methods).
You can also pass optional arguments to `@fastify/busboy` when registering with Fastify. This is useful for setting limits on the content that can be uploaded. A full list of available options can be found in the [`@fastify/busboy` documentation](https://github.com/fastify/busboy#busboy-methods).

**Note**: if the file stream that is provided by `data.file` is not consumed, like in the example below with the usage of pump, the promise will not be fulfilled at the end of the multipart processing.
This behavior is inherited from [busboy](https://github.com/mscdex/busboy).
This behavior is inherited from [`@fastify/busboy`](https://github.com/fastify/busboy).

```js
fastify.register(require('fastify-multipart'), {
Expand All @@ -91,7 +89,7 @@ fastify.register(require('fastify-multipart'), {
```

**Note**: if the file stream that is provided by `data.file` is not consumed, like in the example below with the usage of pump, the promise will not be fulfilled at the end of the multipart processing.
This behavior is inherited from [busboy](https://github.com/mscdex/busboy).
This behavior is inherited from [`@fastify/busboy`](https://github.com/fastify/busboy).

**Note**: if you set a `fileSize` limit and you want to know if the file limit was reached you can:
- listen to `data.file.on('limit')`
Expand Down