js-export
v0.1.0
Published
Utilities to export js data into different acceptable format
Downloads
2
Readme
js-export
Utilities to export js data into different acceptable format for nodejs
Installation
$ npm install --save js-export
Usage
var JSExport = require('js-export');
var jsexport = new JSExport(data, options);
//export data as excel file
jsexport.writeExcel(`<file>`, done);
//download data as excel through http requests
app.get('/exports', function(request, response){
jsexport.downloadExcel(response, options);
});
Export Engine
Additional export engines can be added as a plugins. It should implement write
and download
methods for it to be valid export engine
.
var JSExport = require('js-export');
var jsexport = new JSExport(data, options);
//buffer engine
var bufferEngine = {
write: function(path, done){
//codes
...
},
download:function(response, options){
//codes
...
}
}
//use export engine
jsexport.use('buffer', bufferEngine);
//then use buffer export engine
jsexport.writeBuffer(path, done);
Options
missing
value to set if object to write does not have the given property. default toNA
Engines
excel
Export data to excel format
Options
sheet:String
default sheet name to use. default toSheet
multi:Boolean
will put inner plain objects into their own sheet. default tofalse
flat:Boolean
will flat inner plain object. default totrue
Note!: You may choose flat or multi but not both
csv(WIP)
Export data to csv format
text(WIP)
Export data to text format
json(WIP)
Export data into json format