This library provides a specialized parser for `multipart/form-data` requests specifically designed for AWS Lambda environments. Unlike general-purpose server-based parsers, `aws-lambda-multipart-parser` is tailored to work within the constraints of serverless functions and the particular event structure provided by AWS API Gateway. It takes the raw `event` object from a Lambda invocation and processes its `body` to extract form fields and uploaded files, returning a structured JavaScript object. The current stable version, 0.1.3, indicates a very early stage of development, and the project appears to be abandoned, with no significant updates or commits in several years. Its primary differentiator was its early focus on simplifying `multipart/form-data` handling for AWS Lambda at a time when native support was less mature, abstracting away the complexities of binary media types, base64 encoding, and API Gateway proxy integration nuances.
npm install aws-lambda-multipart-parserVerified import paths — ran on the pinned version, not inferred.
Demonstrates parsing an AWS Lambda event containing multipart/form-data and returning a structured JSON response, including necessary CORS headers.
Consider using newer, actively maintained libraries like `busboy` or implementing custom parsing logic with current Node.js APIs, or leveraging API Gateway's direct integration features for file uploads if applicable.
Ensure your API Gateway method's 'Integration Request' for your Lambda function has 'Use Lambda Proxy Integration' checked, or set `integration: LAMBDA` if using Serverless Framework.
Add `"Access-Control-Allow-Origin": "*"` (or specific origin) to the `headers` object of your Lambda's response.
When returning file content in a JSON response, convert `Buffer` objects to a base64 string (e.g., `file.content.toString('base64')`). Ensure the client knows how to decode it.In API Gateway console, for your POST method's 'Integration Request', check 'Use Lambda Proxy Integration'. If using Serverless Framework, add `integration: LAMBDA` to your function's HTTP event configuration.
Include `headers: { "Access-Control-Allow-Origin": "*" }` (or your specific frontend origin) in your Lambda function's response object.No dependency data recorded yet.