then-busboy
Advanced tools
Comparing version 1.0.3 to 1.0.4
{ | ||
"name": "then-busboy", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "Promise-based wrapper around Busboy, inspired by async-busboy", | ||
@@ -5,0 +5,0 @@ "main": "main.js", |
# then-busboy | ||
Promise-based wrapper around Busboy, inspired by async-busboy | ||
Promise-based wrapper around Busboy, inspired by [async-busboy](https://github.com/m4nuC/async-busboy) | ||
[![dependencies Status](https://david-dm.org/octet-stream/then-busboy/status.svg?style=flat-square)](https://david-dm.org/octet-stream/then-busboy) | ||
[![devDependencies Status](https://david-dm.org/octet-stream/then-busboy/dev-status.svg?style=flat-square)](https://david-dm.org/octet-stream/then-busboy?type=dev) | ||
## Installation | ||
@@ -22,2 +25,10 @@ | ||
### busboy(request[, options]) -> Promise | ||
* http.IncomingMessage **request** - HTTP request object | ||
* object **options** | ||
- boolean **split** - If set as `true`, the `data` | ||
object will be split into two other objects: `fields` and `files`. | ||
- more information about busboy options [here](https://github.com/mscdex/busboy#busboy-methods). | ||
Just import `then-busboy` and pass `request` object as first argument. | ||
@@ -59,15 +70,21 @@ | ||
createServer(callback) | ||
.listen(2319, () => console.log("Server started on http://localhost:2319")) | ||
.listen(2319, () => console.log("Server started on http://localhost:2319")); | ||
``` | ||
`then-busboy` always return a Promise, so you can use it with | ||
`then-busboy` always returns a Promise, so you can use it with | ||
[asynchronous function](https://github.com/tc39/ecmascript-asyncawait) syntax: | ||
```js | ||
// Some your awesome code with async workflow... | ||
// Some of your awesome code with async workflow... | ||
var data = await busboy(req); | ||
``` | ||
And the same code, but with `split: true` option: | ||
```js | ||
var {fields, files} = await busboy(req, {split: true}); | ||
``` | ||
## License | ||
[MIT](https://github.com/octet-stream/then-busboy/blob/master/LICENSE) |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
89
10424
5