-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathpostinstall.js
26 lines (26 loc) · 954 Bytes
/
postinstall.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
const fs = require('fs')
const wget = require('wget-improved')
const ProgressBar = require('progress')
const tar = require('tar')
const src = 'https://github.com/mozilla/DeepSpeech/releases/download/v0.1.1/deepspeech-0.1.1-models.tar.gz'
const output = './models.tar.gz'
let bar = null
console.log('The Demo is now downloading the pre-trained models from %s (roughly 1.4 GB), this will take a few moments...', src)
let download = wget.download(src, output)
download.on('error', console.error)
download.on('progress', progress => bar.tick(progress))
download.on('start', _ => {
bar = new ProgressBar(' downloading [:bar] :percent :etas', {
width: 20,
total: (100000 / 2)
})
})
download.on('end', async _ => {
bar.tick(100000 / 2)
console.log('')
console.log('Extracting tar archive...')
await tar.x({file: output})
console.log('Done extracting archive')
console.log('Removinf temporary tar archive...')
fs.unlinkSync(output)
})