From 80d992795cc1ed1bea4266f8983f638bfcdff16d Mon Sep 17 00:00:00 2001 From: Ferenc Hammerl Date: Wed, 14 Dec 2022 16:13:28 +0100 Subject: [PATCH] Fix linting --- packages/artifact/src/internal/download-http-client.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/packages/artifact/src/internal/download-http-client.ts b/packages/artifact/src/internal/download-http-client.ts index 773c85bb..e365f3af 100644 --- a/packages/artifact/src/internal/download-http-client.ts +++ b/packages/artifact/src/internal/download-http-client.ts @@ -219,14 +219,13 @@ export class DownloadHttpClient { fileDownloadPath: string ): Promise => { destinationStream.close() - // await until file is created at downloadpath - // wrap destinationStream's open event in promise + // await until file is created at downloadpath; node15 and up fs.createWriteStream had not created a file yet await new Promise(resolve => { destinationStream.on('close', resolve) if (destinationStream.writableFinished) { resolve() } - }); + }) await rmFile(fileDownloadPath) destinationStream = fs.createWriteStream(fileDownloadPath) } @@ -281,8 +280,8 @@ export class DownloadHttpClient { // if a throttled status code is received, try to get the retryAfter header value, else differ to standard exponential backoff isThrottledStatusCode(response.message.statusCode) ? await backOff( - tryGetRetryAfterValueTimeInMilliseconds(response.message.headers) - ) + tryGetRetryAfterValueTimeInMilliseconds(response.message.headers) + ) : await backOff() } else { // Some unexpected response code, fail immediately and stop the download