sheetjs/demos/meteor/server/main.js
SheetJS ad47cb433c Math.LOG2E precision issue + new demos [ci skip]
- swift + jsc
- java + rhino
- XMLHttpRequest and friends
2017-09-05 01:34:30 -04:00

24 lines
588 B
JavaScript

/* xlsx.js (C) 2013-present SheetJS -- http://sheetjs.com */
import { Meteor } from 'meteor/meteor';
const XLSX = require('xlsx');
Meteor.methods({
upload: (bstr, name) => {
/* read the data and return the workbook object to the frontend */
return XLSX.read(bstr, {type:'binary'});
},
download: () => {
/* generate a workbook object and return to the frontend */
const data = [
["a", "b", "c"],
[ 1 , 2 , 3 ]
];
const ws = XLSX.utils.aoa_to_sheet(data);
const wb = {SheetNames: ["Sheet1"], Sheets:{Sheet1:ws }};
return wb;
}
});
Meteor.startup(() => { });