async uploadBuffer()

in gh-actions-artifact-client/src/upload-http-client.js [177:200]


  async uploadBuffer(resourceUrl, startIndex, chunkLength, totalSize) {
    const bufSlice = this.partBuffer.slice(startIndex, startIndex + chunkLength)
    const endIndex = startIndex + chunkLength - 1
    const result = await this.uploadChunkFunction(
      0,
      resourceUrl,
      () => {
        const passThrough = new stream.PassThrough()
        passThrough.end(bufSlice)
        return passThrough
      },
      startIndex,
      endIndex,
      totalSize,
      false,
      0
    )
    if (!result) {
      throw new Error(
        `File upload failed for ${resourceUrl} range ${startIndex}-${endIndex}/${totalSize}`
      )
    }
    return result
  }