1.0.2 • Published 7 years ago
koa-csv v1.0.2
koa-csv
CSV files serving as json API middleware for koa
Usage Example
const Koa = require('koa')
const app = new Koa()
app.use(require('koa-csv')(root, opts))rootroot directory stringoptsoption object
Request Example
for test.csv like this
| Name | Value |
|---|---|
| name | value |
GET /test.csv[{
"Name": "name",
"Value": "value"
}]GET /test.csv?axis=col{
"Name": ["name"],
"Value": ["value"]
}Options
trimwhether or not trim each cell, defaulttrueaxisdefault isrow, csv will be converted to an array of objects representing each line in csv, ifaxisiscol, csv will be converted to an object, each property representing column in csvdelimitercsv delimiter, default,prefixset the prefix of request path to matchlsdirenable lsdir if path is a dir, default false
TODO
- gzip support