https://github.com/noobtw/koa-json2xlsx
Json to excel(xlsx) middleware for koa.
https://github.com/noobtw/koa-json2xlsx
excel json koa koa2 xlsx
Last synced: 2 months ago
JSON representation
Json to excel(xlsx) middleware for koa.
- Host: GitHub
- URL: https://github.com/noobtw/koa-json2xlsx
- Owner: NoobTW
- License: mit
- Created: 2018-02-18T11:24:37.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-03-05T13:56:04.000Z (over 6 years ago)
- Last Synced: 2025-03-10T17:56:18.189Z (3 months ago)
- Topics: excel, json, koa, koa2, xlsx
- Language: JavaScript
- Homepage:
- Size: 11.7 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# koa-json2xlsx
 
> Json to excel(xlsx) middleware for [koa](https://github.com/koajs/koa)
Need async/await support, so you have to use Node v7.6+, or use `--harmony` option.
## Installation
Install using [npm](https://www.npmjs.com):
```bash
npm install koa-json2xlsx
```## Usage
```javascript
const Koa = require('koa');
const koaJson2xlsx = require('koa-json2xlsx');const app = new Koa();
const data = [
{
name: 'Peter',
age: 18,
foo: 'bar'
},
{
name: 'Jane',
age: 19,
foo: 'bar'
}
];app.use(koaJson2xlsx());
app.use(ctx => {
ctx.xlsx('data.xlsx', data);
});
```## Reference
#### xlsx
**ctx.xlsx(filename, [option])**
You can find available option [here](https://github.com/rikkertkoppes/json2xls#options).
#### xls
An alias of `xlsx`.
## Tests
Run tests using `npm test`.