-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.ts
38 lines (30 loc) · 891 Bytes
/
index.ts
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
32
33
34
35
36
37
38
#!/usr/bin/env node
/* wk.js (C) 2017-present SheetJS -- http://sheetjs.com */
/* vim: set ts=2 ft=typescript: */
import { fork } from 'child_process';
import * as blessed from 'blessed';
import { WorkBook } from 'xlsx';
import initialize from './src/';
const filename = process.argv[2];
/* init screen */
const screen: blessed.Widgets.Screen = blessed.screen({ title: "SheetJS spreadsheet viewer - " + filename });
const loader = blessed.loading({
align: 'center',
border: 'line',
height: 5,
hidden: true,
left: 'center',
parent: screen,
tags: true,
top: 'center',
width: '50%'
});
loader.load("Loading " + filename + " ...");
const n = fork(__dirname + '/bg.js', [], { silent: true });
n.send(filename);
n.on('message', (wb: [WorkBook, Error]) => {
loader.stop();
if(wb[1] && wb[1].message) throw wb[1];
n.disconnect();
initialize(wb[0], filename, screen);
});