deno.land / x / sheetjs@v0.18.3 / demos / meteor / server / main.js

نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/* xlsx.js (C) 2013-present SheetJS -- http://sheetjs.com */import { Meteor } from 'meteor/meteor';import { check } from 'meteor/check';import XLSX from 'xlsx';
Meteor.methods({ /* read the data and return the workbook object to the frontend */ uploadU: (ab, name) => { check(ab, Uint8Array); check(name, String); return XLSX.read(ab, { type: 'array' }); }, download: (html) => { check(html, String); let wb; if (html.length > 3) { /* parse workbook if html is available */ wb = XLSX.read(html, { type: 'binary' }); } else { /* generate a workbook object otherwise */ const data = [['a', 'b', 'c'], [1, 2, 3]]; const ws = XLSX.utils.aoa_to_sheet(data); wb = XLSX.utils.book_new(); XLSX.utils.book_append_sheet(wb, ws, 'SheetJS'); } return wb; },});
Meteor.startup(() => { });
sheetjs

Version Info

Tagged at
2 years ago