1 | <h1 align="left">fdex</h1>
|
2 |
|
3 | [![npm version][npm-src]][npm-href]
|
4 | [![types][types-src]][types-href]
|
5 | [![size][size-src]][size-href]
|
6 | [![coverage][coverage-src]][coverage-href]
|
7 | [![vulnerabilities][vulnerabilities-src]][vulnerabilities-href]
|
8 | [![dependencies][dep-src]][dep-href]
|
9 | [![License][license-src]][license-href]
|
10 |
|
11 | > small form-data extractor
|
12 |
|
13 | ## Installation
|
14 |
|
15 | ```bash
|
16 | $ npm i fdex
|
17 | ```
|
18 |
|
19 | ## Usage
|
20 |
|
21 | ```js
|
22 | import fdex, {getBoundary} from 'fdex';
|
23 | import express from 'express';
|
24 |
|
25 | const app = express();
|
26 |
|
27 | app.post('/', (req) => {
|
28 | const contentType = req.headers['content-type'];
|
29 | const boundary = getBoundary(contentType);
|
30 |
|
31 | const extractor = fdex(boundary);
|
32 | req.pipe(extractor)
|
33 | .on('data', ([headers, body]) => {
|
34 | console.info(headers, body);
|
35 | })
|
36 | ;
|
37 | });
|
38 |
|
39 | app.listen(3000);
|
40 | ```
|
41 |
|
42 | ## About
|
43 |
|
44 | Jet another `multipart/form-data` extractor/processor.
|
45 | This projects aim was to understand and process the `multipart/form-data` format without any
|
46 | additional dependencies.
|
47 |
|
48 | ## Licence
|
49 |
|
50 | MIT License, see [LICENSE](./LICENSE)
|
51 |
|
52 | [npm-src]: https://badgen.net/npm/v/fdex
|
53 |
|
54 | [npm-href]: https://www.npmjs.com/package/fdex
|
55 |
|
56 | [size-src]: https://badgen.net/packagephobia/install/fdex
|
57 |
|
58 | [size-href]: https://packagephobia.com/result?p=fdex
|
59 |
|
60 | [types-src]: https://badgen.net/npm/types/fdex
|
61 |
|
62 | [types-href]: https://www.npmjs.com/package/fdex
|
63 |
|
64 | [coverage-src]: https://coveralls.io/repos/github/sovrin/fdex/badge.svg?branch=master
|
65 |
|
66 | [coverage-href]: https://coveralls.io/github/sovrin/fdex?branch=master
|
67 |
|
68 | [vulnerabilities-src]: https://snyk.io/test/github/sovrin/fdex/badge.svg
|
69 |
|
70 | [vulnerabilities-href]: https://snyk.io/test/github/sovrin/fdex
|
71 |
|
72 | [dep-src]: https://img.shields.io/librariesio/release/npm/fdex
|
73 |
|
74 | [dep-href]: https://img.shields.io/librariesio/release/npm/fdex
|
75 |
|
76 | [license-src]: https://badgen.net/github/license/sovrin/fdex
|
77 |
|
78 | [license-href]: LICENSE
|