Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

aws-multipart-parser

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

aws-multipart-parser

Parser of multipart/form-data requests for AWS Lambda with typed output, based on the recently inactive myshenin/aws-lambda-multipart-parser

  • 0.2.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2.9K
increased by7.53%
Maintainers
1
Weekly downloads
 
Created
Source

aws-multipart-parser

Introduction

Support of multipart/form-data requests is a relatively new feature for AWS, data from a form post shows through as event-body and while most server side frameworks have ready parsers for form data from requests, in a lambda function there may be a need to parse the event.body property manually.

This package is a fork from myshenin/aws-lambda-multipart-parser as I found that the provided API did not work for data with binary file form data, and the parent didn't seem to be intensively maintained in the last few months, I've made minor API changes according to my needs and added types & documentation to make usage clearer for serverless users/typescript callers.

Guide for use

  1. Enable binary data types on your API gateway, and add multipart/form-data to the content-types list. If using serverless (recommended), use the plugin serverless-apigw-binary and modify your serverless.yml file accordingly

serverless.yml:

plugins:
 - serverless-apigw-binary

custom:
  apigwBinary:
    types:
      - 'multipart/form-data'
  1. Now in your lambda function body

handler.js

import { parse } from 'aws-multipart-parser'

// ...

exports.myHandler = function(event, context, callback) {
    const formData = parse(event, true);

    // do stuff

    callback(null, "some success message");
}

Keywords

FAQs

Package last updated on 11 Mar 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc