Adopt fatjar download script for latest node version

This commit is contained in:
BoykoAlex
2019-06-20 16:40:48 -04:00
parent a8f0ea0c69
commit 8c69778538
8 changed files with 30 additions and 10 deletions

View File

@@ -21,7 +21,12 @@ fileExists(localFileName).then(exists => {
if (!exists) {
console.log(`Downloading ${serverDownloadUrl} to ${localFileName}`);
fileExists(serverHome)
.then(doesExist => { if (!doesExist) fs.mkdir(serverHome) })
.then(doesExist => {
if (!doesExist)
fs.mkdir(serverHome, err => {
if (err) console.error('Failed to create folder: ' + JSON.stringify(err));
});
})
.then(() => download(serverDownloadUrl))
.then(data => fs.writeFileSync(localFileName, data))
.then(() => fileExists(localFileName))