in gh-actions-artifact-client/src/upload-http-client.js [33:88]
async uploadStream(name, inputStream, options) {
path_and_artifact_name_validation.checkArtifactName(name)
const response = await this.createArtifactInFileContainer(name, options)
if (!response.fileContainerResourceUrl) {
throw new Error(
'No URL provided by the Artifact Service to upload an artifact to'
)
}
const streamUploader = new StreamUploader(
name,
response.fileContainerResourceUrl,
this.partSize,
this.chunkSize,
async (
httpClientIndex,
resourceUrl,
openStream,
start,
end,
uploadFileSize,
isGzip,
totalFileSize
) => {
return await this.uploadChunk(
httpClientIndex,
resourceUrl,
openStream,
start,
end,
uploadFileSize,
isGzip,
totalFileSize
)
}
)
await new Promise(resolve => {
inputStream.on('data', async data => {
await streamUploader.onData(
data,
async flushFunctionToExecuteWhilePaused => {
inputStream.pause()
await flushFunctionToExecuteWhilePaused()
inputStream.resume()
}
)
})
inputStream.on('end', async () => {
await streamUploader.flush()
resolve()
})
})
await this.patchArtifactSize(streamUploader.totalSize, name)
}