mirror of https://github.com/actions/toolkit
add explicit options
parent
bf93b54558
commit
73babeabef
|
@ -18,7 +18,7 @@ import {
|
||||||
} from '../../generated'
|
} from '../../generated'
|
||||||
import {getBackendIdsFromToken} from '../shared/util'
|
import {getBackendIdsFromToken} from '../shared/util'
|
||||||
import {ArtifactNotFoundError} from '../shared/errors'
|
import {ArtifactNotFoundError} from '../shared/errors'
|
||||||
import {BlobClient} from '@azure/storage-blob'
|
import {BlobClient, BlobDownloadOptions} from '@azure/storage-blob'
|
||||||
|
|
||||||
const scrubQueryParameters = (url: string): string => {
|
const scrubQueryParameters = (url: string): string => {
|
||||||
const parsed = new URL(url)
|
const parsed = new URL(url)
|
||||||
|
@ -41,14 +41,20 @@ async function exists(path: string): Promise<boolean> {
|
||||||
|
|
||||||
async function streamExtract(url: string, directory: string): Promise<void> {
|
async function streamExtract(url: string, directory: string): Promise<void> {
|
||||||
const blobClient = new BlobClient(url)
|
const blobClient = new BlobClient(url)
|
||||||
const response = await blobClient.download()
|
const options: BlobDownloadOptions = {
|
||||||
core.info(util.inspect(blobClient))
|
maxRetryRequests: 3,
|
||||||
core.info(util.inspect(response))
|
abortSignal: undefined,
|
||||||
|
onProgress: (progress) => core.debug(`Download progress: ${progress.loadedBytes}`)
|
||||||
|
}
|
||||||
|
|
||||||
|
const response = await blobClient.download(0, 0, options)
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
response.readableStreamBody
|
response.readableStreamBody
|
||||||
?.pipe(unzip.Extract({path: directory}))
|
?.pipe(unzip.Extract({path: directory}))
|
||||||
.on('close', resolve)
|
.on('close', resolve)
|
||||||
.on('error', reject)
|
.on('error', reject)
|
||||||
|
.on('aborted', reject)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue