-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathindex.js
34 lines (27 loc) · 936 Bytes
/
index.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
32
33
34
(async()=> {
//Print Header
const screen = require('./lib/screen');
let args = process.argv;
for (let arg of args) {
if (arg === "--log") screen.logMode();
}
//try to download prebuilds
await require("./lib/installer")(`${__dirname}/node_modules/leveldown/prebuilds/`);
//load file system and ipfs
const fs = require('fs');
const ipfs = require("ipfs-simple");
ipfs.create();
/**
* Add Error listener
*/
const errorHandler = (err) => fs.appendFileSync('_error.log', err.stack + "\r\n-------------------------------\r\n");
process.on('uncaughtException', errorHandler);
process.on('unhandledRejection', errorHandler);
//make sure wallet and stream are initialized
require('./lib/wallet');
require('./lib/stream');
//load api
require('./lib/api');
//load syncer
require('./lib/syncer');
})();