mergeContents

fun <Error class: unknown class>.mergeContents(files: List<Pair<String, String>>, concurrency: Int = 1, destination: <Error class: unknown class>.() -> Unit): Flow<S3Response<*>>

This function performs a merge by using multipart upload copy operations using the S3Client. It copies multiple source files into a single destination object in an S3 bucket.

Return

A flow of S3Response objects for each part of the multipart copy operation.

Example usage:

val s3Client =  S3Client.create()

val sourceFiles = flowOf(
"source-bucket-1" to "file1.txt",
"source-bucket-2" to "file2.txt",
"source-bucket-3" to "file3.txt"
)

s3Client
.mergeContents(sourceFiles) {
bucket = "my-bucket"
key = "merged-file.txt"
}
.collect { response ->
println("Copied part: ${response.key}")
}

Parameters

bucket

The S3 bucket where the destination object will be stored.

key

The key of the destination object in the S3 bucket.

concurrency

The number of concurrent copy operations to perform. Default is 1.

files

A flow of source file pairs, where the first element is the source bucket and the second element is the source key.