1
0
Fork 0
mirror of https://github.com/actions/toolkit synced 2025-05-09 16:43:02 +00:00

adding logger for blob client and response

This commit is contained in:
Vallie Joseph 2023-12-18 23:09:10 +00:00
parent 0c0770ce57
commit bf93b54558
3 changed files with 245 additions and 7 deletions

View file

@ -1,13 +1,14 @@
import fs from 'fs/promises'
import * as github from '@actions/github'
import * as core from '@actions/core'
import * as httpClient from '@actions/http-client'
// import * as httpClient from '@actions/http-client'
import * as util from 'util'
import unzip from 'unzip-stream'
import {
DownloadArtifactOptions,
DownloadArtifactResponse
} from '../shared/interfaces'
import {getUserAgentString} from '../shared/user-agent'
// import {getUserAgentString} from '../shared/user-agent'
import {getGitHubWorkspaceDir} from '../shared/config'
import {internalArtifactTwirpClient} from '../shared/artifact-twirp-client'
import {
@ -19,7 +20,6 @@ import {getBackendIdsFromToken} from '../shared/util'
import {ArtifactNotFoundError} from '../shared/errors'
import {BlobClient} from '@azure/storage-blob'
const scrubQueryParameters = (url: string): string => {
const parsed = new URL(url)
parsed.search = ''
@ -42,9 +42,11 @@ async function exists(path: string): Promise<boolean> {
async function streamExtract(url: string, directory: string): Promise<void> {
const blobClient = new BlobClient(url)
const response = await blobClient.download()
core.info(util.inspect(blobClient))
core.info(util.inspect(response))
return new Promise((resolve, reject) => {
response.readableStreamBody?.pipe(unzip.Extract({path: directory}))
response.readableStreamBody
?.pipe(unzip.Extract({path: directory}))
.on('close', resolve)
.on('error', reject)
})