-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
22 lines (19 loc) · 550 Bytes
/
index.js
File metadata and controls
22 lines (19 loc) · 550 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
const fs = require('fs');
const JSZip = require('jszip');
const { promisify } = require('util');
const EventEmitter = require('events');
const readFile = promisify(fs.readFile);
class Xmind extends EventEmitter {
static async load(filename) {
if (Array.isArray(filename))
return Promise.all(filename.map(Sketch.load));
const file = await readFile(filename);
const doc = await JSZip.loadAsync(file);
return new Xmind(doc);
}
constructor(document){
super();
this.document = document;
}
}
module.exports = Xmind;