Cleanups and package refactoring

This commit is contained in:
Bassem Dghaidi
2024-10-24 05:19:48 -07:00
committed by GitHub
parent 89354f6540
commit 28dbd8ff93
7 changed files with 447 additions and 20 deletions

View File

@@ -0,0 +1,27 @@
import * as core from '@actions/core'
import {
BlobClient,
BlockBlobClient,
BlockBlobParallelUploadOptions
} from '@azure/storage-blob'
export async function UploadCacheFile(
signedUploadURL: string,
archivePath: string,
): Promise<{}> {
// TODO: tighten the configuration and pass the appropriate user-agent
// Specify data transfer options
const uploadOptions: BlockBlobParallelUploadOptions = {
blockSize: 4 * 1024 * 1024, // 4 MiB max block size
concurrency: 4, // maximum number of parallel transfer workers
maxSingleShotSize: 8 * 1024 * 1024, // 8 MiB initial transfer size
};
const blobClient: BlobClient = new BlobClient(signedUploadURL)
const blockBlobClient: BlockBlobClient = blobClient.getBlockBlobClient()
core.debug(`BlobClient: ${JSON.stringify(blobClient)}`)
core.debug(`blockBlobClient: ${JSON.stringify(blockBlobClient)}`)
return blockBlobClient.uploadFile(archivePath, uploadOptions);
}