forked from moszeed/kindle-periodical
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.js
More file actions
21 lines (19 loc) · 758 Bytes
/
install.js
File metadata and controls
21 lines (19 loc) · 758 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
(async () => {
try {
const download = require('download');
const kindlegenDownloadUrls = {
'darwin': 'https://kindlegen.s3.amazonaws.com/KindleGen_Mac_i386_v2_9.zip',
'linux' : 'https://kindlegen.s3.amazonaws.com/kindlegen_linux_2.6_i386_v2_9.tar.gz',
'win32' : 'https://kindlegen.s3.amazonaws.com/kindlegen_win32_v2_9.zip'
};
const selectedUrl = kindlegenDownloadUrls[process.platform];
if (!selectedUrl) {
throw new Error('not supported platform');
}
await download(selectedUrl, 'bin', {extract: true});
console.log('Download completed');
} catch (err) {
console.log('fail to download');
throw Error(err);
}
})();