Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.then(() => DownloadFile(serverDownloadUrl, localFileName, (bytesDone, percent) => installSignal && installSignal.setTitle(`downloading ${Math.floor(serverDownloadSize / bytesToMegabytes)} MB (${percent}% done)`), serverDownloadSize))
.then(() => installSignal && installSignal.setTitle('unpacking...'))
this.logger.log(`Downloading ${url} to ${localFileName}`);
const serverHomeExists = await this.fileExists(serverHome);
if (!serverHomeExists) {
new Promise((resolve, reject) => {
fs.mkdir(serverHome, err => {
if (err) {
return reject(err);
}
return resolve();
});
});
}
await DownloadFile(url, localFileName, (bytesDone, percent) =>
this.updateStatusBar(`downloading ${percent}%`)
);
this.updateStatusBar("unpacking");
await decompress(localFileName, serverHome);
const serverBinExists = await this.fileExists(
path.join(serverHome, "bin", process.platform, serverBinary)
);
if (!serverBinExists) {
throw Error(
`Failed to install the ${this.getServerName()} language server`
);
}
this.updateStatusBar("installed");
await new Promise((resolve, reject) => {
.then((size) => DownloadFile(this.serverDownloadUrl, localFileName, (bytesDone, percent) => this.handleDownlaodPercentChange(bytesDone, size, percent), size))
.then(() => this.fileExists(this.getServerJar()))
.then(() => DownloadFile(serverDownloadUrl, localFileName, provideInstallStatus, serverDownloadSize))
.then(() => this.updateInstallStatus('unpacking'))