express-csv-middleware

0.1.0 • Public • Published

NPM version Build Status Dependency Status

Express middleware that parse text/csv content into array or object.

Install

$ npm install --save express-csv-middleware

Usage

var expressCsv = require('express-csv-middleware');
 
var bodyParserOptions = {
  // https://github.com/expressjs/body-parser#bodyparsertextoptions
};
var csvOptions = {
  // http://csv.adaltas.com/parse/
  // http://csv.adaltas.com/stringify/
};
 
app.use(expressCsv(bodyParserOptions, csvOptions));
 
// POST with Content-Type: text/csv
app.post(function(req, res) {
  console.log(req.body);    // [['header', 'row'], ['body', 'rows'], ...]
  app.csv(req.body);        // Respond with Content-Type: text/csv
})
 

License

MIT © Greg Wang

Package Sidebar

Install

npm i express-csv-middleware

Weekly Downloads

39

Version

0.1.0

License

MIT

Last publish

Collaborators

  • gregwym