Commit a3d79e61 authored by Administrator's avatar Administrator

missing output

parent 649d15fa
var fs = require('fs'); var fs = require('fs');
var xlsx = require('xlsx'); var xlsx = require('xlsx');
var cvcsv = require('csv');
var mime = require('mime'); var mime = require('mime');
exports = module.exports = XLSX_json; exports = module.exports = XLSX_json;
...@@ -24,8 +23,17 @@ function XLSX_json(config, callback) { ...@@ -24,8 +23,17 @@ function XLSX_json(config, callback) {
function CV(config, callback) { function CV(config, callback) {
var wb = this.load_xlsx(config.input) var wb = this.load_xlsx(config.input)
var csv = this.to_json(wb); var json = this.to_json(wb);
return callback(null,csv); var output = config.output;
if (config.output !== null) {
var stream = fs.createWriteStream(output, {
flags: 'w'
});
stream.write(JSON.stringify(json));
return callback(null, json);
} else {
return callback(null, json);
}
} }
CV.prototype.load_xlsx = function(input) { CV.prototype.load_xlsx = function(input) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment