-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathbfg.js
More file actions
28 lines (24 loc) · 658 Bytes
/
Copy pathbfg.js
File metadata and controls
28 lines (24 loc) · 658 Bytes
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
const request = require('request')
const fs = require('fs-extra')
const spawn = require('./spawn')
const config = require('./config')
const version = '1.13.0'
const bfgUrl = `http://repo1.maven.org/maven2/com/madgag/bfg/${version}/bfg-${version}.jar`
const bfgPath = `./bfg-${version}.jar`
const download = () => {
return new Promise((resolve, reject) => {
if (fs.pathExistsSync(bfgPath)) {
resolve()
} else {
const r = request(bfgUrl).pipe(fs.createWriteStream(bfgPath))
r.on('finish', (err) => {
if (err) {
return reject(err)
} else {
resolve()
}
})
}
})
}
download()