Fix dist download

This commit is contained in:
Paul Merlin 2020-06-13 14:37:12 +02:00
parent 2bf5eec3b6
commit 8e2fd532f1
2 changed files with 13 additions and 11 deletions

2
dist/main/index.js vendored

File diff suppressed because one or more lines are too long

View File

@ -141,16 +141,18 @@ async function httpGetString(url: string): Promise<string> {
} }
async function httpDownload(url: string, localPath: string): Promise<void> { async function httpDownload(url: string, localPath: string): Promise<void> {
const writeStream = fs.createWriteStream(localPath) const response = await httpc.get(url)
try { return new Promise<void>(function (resolve, reject) {
const response = await httpc.get(url) const writeStream = fs.createWriteStream(localPath)
response.message.pipe(writeStream) response.message
return new Promise<void>(function (resolve) { .pipe(writeStream)
resolve() .on('close', () => {
}) resolve()
} finally { })
writeStream.close() .on('error', err => {
} reject(err)
})
})
} }
async function extractZip(zip: string, destination: string): Promise<void> { async function extractZip(zip: string, destination: string): Promise<void> {