From 73babeabefd68ff5bd922a4507d757c0b80d2a3d Mon Sep 17 00:00:00 2001 From: srryan Date: Tue, 19 Dec 2023 11:49:39 -0500 Subject: [PATCH] add explicit options --- .../src/internal/download/download-artifact.ts | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/packages/artifact/src/internal/download/download-artifact.ts b/packages/artifact/src/internal/download/download-artifact.ts index 7b67454d..443eb47b 100644 --- a/packages/artifact/src/internal/download/download-artifact.ts +++ b/packages/artifact/src/internal/download/download-artifact.ts @@ -18,7 +18,7 @@ import { } from '../../generated' import {getBackendIdsFromToken} from '../shared/util' import {ArtifactNotFoundError} from '../shared/errors' -import {BlobClient} from '@azure/storage-blob' +import {BlobClient, BlobDownloadOptions} from '@azure/storage-blob' const scrubQueryParameters = (url: string): string => { const parsed = new URL(url) @@ -41,14 +41,20 @@ async function exists(path: string): Promise { async function streamExtract(url: string, directory: string): Promise { const blobClient = new BlobClient(url) - const response = await blobClient.download() - core.info(util.inspect(blobClient)) - core.info(util.inspect(response)) + const options: BlobDownloadOptions = { + maxRetryRequests: 3, + abortSignal: undefined, + onProgress: (progress) => core.debug(`Download progress: ${progress.loadedBytes}`) + } + + const response = await blobClient.download(0, 0, options) + return new Promise((resolve, reject) => { response.readableStreamBody ?.pipe(unzip.Extract({path: directory})) .on('close', resolve) .on('error', reject) + .on('aborted', reject) }) }