form-data-parser

0.0.3 • Public • Published

form-data-parser

Middleware for connect or express that parses FormData in a sane way, no streams necessary.

Note: Originally made to work with the ember-cli-form-data addon.

Build Status Coverage Status
NPM

Usage

npm install form-data-parser --save
var express = require('express');
var formDataParser = require('form-data-parser');
 
var app = express();
var fdp = formDataParser({
  attrs: {
    comments: 'array',
    coverPhoto: 'dataUri'
  }
});
 
/**
 * Sent
 * {
 *   blogPost: {
 *     comments: [1, 2],
 *     coverPhoto: formDataFile
 *   }
 * }
*/
app.post('/api/blog-post', fdp, function (req, res) {
  // req.body => { blogPost: comments: [1, 2], coverPhoto: 'data: image/png; base64, dasfe254....' }
});

Package Sidebar

Install

npm i form-data-parser

Weekly Downloads

103

Version

0.0.3

License

ISC

Last publish

Collaborators

  • knownasilya