0.1.0 • Published 9 years ago

express-csv-middleware v0.1.0

Weekly downloads
164
License
MIT
Repository
github
Last release
9 years ago

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