Files
toolkit/packages/cache/src/internal/blob/download-cache.ts
T

31 lines
765 B
TypeScript
Raw Normal View History

2024-06-17 01:17:10 -07:00
import * as core from '@actions/core'
import {
BlobClient,
BlockBlobClient,
2024-11-14 03:22:03 -08:00
BlobDownloadOptions
} from '@azure/storage-blob'
2024-06-17 01:17:10 -07:00
export async function DownloadCacheFile(
signedUploadURL: string,
2024-11-14 03:22:03 -08:00
archivePath: string
): Promise<{}> {
const downloadOptions: BlobDownloadOptions = {
2024-11-14 03:22:03 -08:00
maxRetryRequests: 5
}
2024-06-17 01:17:10 -07:00
// TODO: tighten the configuration and pass the appropriate user-agent
const blobClient: BlobClient = new BlobClient(signedUploadURL)
const blockBlobClient: BlockBlobClient = blobClient.getBlockBlobClient()
core.debug(`BlobClient: ${JSON.stringify(blobClient)}`)
core.debug(`blockBlobClient: ${JSON.stringify(blockBlobClient)}`)
2024-11-14 03:22:03 -08:00
return blockBlobClient.downloadToFile(
archivePath,
0,
undefined,
downloadOptions
)
}