I want to write API which will download S3 Directory and return response media type as octet stream.
I have tried TransferManager with MultiFileDownload sample code as:
TransferManager transferManager = TransferManagerBuilder.standard().withS3Client(s3client)
.withDisableParallelDownloads(false).withMinimumUploadPartSize(Long.valueOf(5 * MB))
.withMultipartUploadThreshold(Long.valueOf(16 * MB)).withMultipartCopyPartSize(Long.valueOf(5 * MB))
.withMultipartCopyThreshold(Long.valueOf(100 * MB)).withExecutorFactory(new ExecutorFactory() {
@Override
public ExecutorService newExecutor() {
return createExecutorService(20);
}
}).build();
file = new File("SomePath");
MultipleFileDownload multipleFileDownload = transferManager.downloadDirectory("SomeBucketName","SomeObjectName", file);
multipleFileDownload.waitForCompletion();
How to return the S3 directory response as an octet stream to prevent connection timeout on the client side?