Giter Club home page Giter Club logo

lmpp's Introduction

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");
}

lmpp's People

Contributors

myshenin avatar jalleyne avatar caiolrm avatar tony-aq avatar mamerisawesome avatar secretshardul avatar

lmpp's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.