Gathering detailed insights and metrics for @tinyanvil/http-multipart-body-parser
Gathering detailed insights and metrics for @tinyanvil/http-multipart-body-parser
Gathering detailed insights and metrics for @tinyanvil/http-multipart-body-parser
Gathering detailed insights and metrics for @tinyanvil/http-multipart-body-parser
npm install @tinyanvil/http-multipart-body-parser
Typescript
Module System
Min. Node Version
Node Version
NPM Version
68.6
Supply Chain
97
Quality
74.8
Maintenance
50
Vulnerability
99.6
License
JavaScript (88.65%)
TypeScript (10.87%)
CSS (0.47%)
Shell (0.02%)
Total Downloads
661
Last Day
1
Last Week
6
Last Month
16
Last Year
117
3,759 Stars
2,279 Commits
373 Forks
35 Watching
11 Branches
194 Contributors
Minified
Minified + Gzipped
Latest Version
1.0.1
Package Id
@tinyanvil/http-multipart-body-parser@1.0.1
Unpacked Size
14.62 kB
Size
4.32 kB
File Count
6
NPM Version
6.14.4
Node Version
12.16.2
Cumulative downloads
Total Downloads
Last day
0%
1
Compared to previous day
Last week
0%
6
Compared to previous week
Last month
700%
16
Compared to previous month
Last year
-17%
117
Compared to previous year
3
1
2
HTTP json body parser middleware for the middy framework, the stylish Node.js middleware engine for AWS Lambda
Automatically parses HTTP requests with content type multipart/form-data
and converts the body into an
object. Also handles gracefully broken JSON as UnprocessableEntity (422 errors)
if used in combination with httpErrorHandler
.
It can also be used in combination with validator so that the content can be validated.
Note: by default this is going to parse only events that contain the header Content-Type
(or content-type
) set to multipart/form-data
. If you want to support different casing for the header name (e.g. Content-type
) then you should use the httpHeaderNormalizer
middleware before this middleware.
To install this middleware you can use NPM:
1npm install --save @middy/http-multipart-body-parser
busboy
(object) (optional): defaults to {}
and it can be used to pass extraparameters to the internal busboy
instance at creation time. Checkout the official documentation for more information on the supported options.Note: this middleware will buffer all the data as it is processed internally by busboy
, so, if you are using this approach to parse significantly big volumes of data, keep in mind that all the data will be allocated in memory. This is somewhat inevitable with Lambdas (as the data is already encoded into the JSON in memory as Base64), but it's good to keep this in mind and evaluate the impact on you application.
If you really have to deal with big files, then you might also want to consider to allowing your users to directly upload files to S3
1const middy = require('@middy/core') 2const { httpMultipartBodyParser } = require('@middy/http-multipart-body-parser') 3const handler = middy((event, context, cb) => { 4 cb(null, {}) 5}) 6handler.use(httpMultipartBodyParser()) 7// invokes the handler 8const event = { 9 headers: { 10 'content-type': 'multipart/form-data; boundary=----WebKitFormBoundaryppsQEwf2BVJeCe0M' 11 }, 12 body: 'LS0tLS0tV2ViS2l0Rm9ybUJvdW5kYXJ5cHBzUUV3ZjJCVkplQ2UwTQ0KQ29udGVudC1EaXNwb3NpdGlvbjogZm9ybS1kYXRhOyBuYW1lPSJmb28iDQoNCmJhcg0KLS0tLS0tV2ViS2l0Rm9ybUJvdW5kYXJ5cHBzUUV3ZjJCVkplQ2UwTS0t', 13 isBase64Encoded: true 14} 15handler(event, {}, (_, body) => { 16 expect(body).toEqual({ foo: 'bar' }) 17})
For more documentation and examples, refers to the main Middy monorepo on GitHub or Middy official website.
Everyone is very welcome to contribute to this repository. Feel free to raise issues or to submit Pull Requests.
Licensed under MIT License. Copyright (c) 2017-2018 Luciano Mammino and the Middy team.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
2 out of 2 merged PRs checked by a CI test -- score normalized to 10
Reason
project has 33 contributing companies or organizations
Details
Reason
no dangerous workflow patterns detected
Reason
update tool detected
Details
Reason
project is fuzzed
Details
Reason
license file detected
Details
Reason
30 commit(s) and 15 issue activity found in the last 90 days -- score normalized to 10
Reason
packaging workflow detected
Details
Reason
all dependencies are pinned
Details
Reason
SAST tool is run on all commits
Details
Reason
security policy file detected
Details
Reason
GitHub workflow tokens follow principle of least privilege
Details
Reason
0 existing vulnerabilities detected
Reason
branch protection is not maximal on development and all release branches
Details
Reason
badge detected: Passing
Reason
Found 0/22 approved changesets -- score normalized to 0
Score
Last Scanned on 2025-02-05T14:32:08Z
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More