JSPM

lambda-multipart-parser

0.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 17026
  • Score
    100M100P100Q145883F
  • License MIT

This module will parse the multipart-form containing files and fields from the lambda event object

Package Exports

  • lambda-multipart-parser

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (lambda-multipart-parser) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

lambda-multipart-parser

npm install lambda-multipart-parser --save

Introduction

This module will parse the multipart-form containing files and fields from the lambda event object.

Description

@param {event} - an event containing the multipart-form in the body
@return {object} - a JSON object containing array of files and fields, sample below.

{
    files: [
        {
            filename: 'test.pdf',
            content: <Buffer 25 50 6f 62 ... >,
            contentType: 'application/pdf',
            encoding: '7bit',
            fieldname: 'uploadFile1'
        }
    ],
    field1: 'VALUE1',
    field2: 'VALUE2',
}

Usage

const parser = require('lambda-multipart-parser');

const result = await parser.parse(event);
console.log(result.files);

Test

npm run test