express-csv-middleware
v0.1.0
Published
Express middleware that parse text/csv content into array or object.
Downloads
220
Maintainers
Readme
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