getObjectTorrent method
Returns torrent files from a bucket. BitTorrent can save you bandwidth
when you're distributing large files.
To use GET, you must have READ access to the object.
This functionality is not supported for Amazon S3 on Outposts.
The following action is related to GetObjectTorrent:
Parameter bucket :
The name of the bucket containing the object for which to get the torrent
files.
Parameter key :
The object key for which to get the information.
Parameter expectedBucketOwner :
The account ID of the expected bucket owner. If the account ID that you
provide does not match the actual owner of the bucket, the request fails
with the HTTP status code 403 Forbidden (access denied).
Implementation
Future<GetObjectTorrentOutput> getObjectTorrent({
required String bucket,
required String key,
String? expectedBucketOwner,
RequestPayer? requestPayer,
}) async {
final headers = <String, String>{
if (expectedBucketOwner != null)
'x-amz-expected-bucket-owner': expectedBucketOwner.toString(),
if (requestPayer != null) 'x-amz-request-payer': requestPayer.value,
};
final $result = await _protocol.sendRaw(
method: 'GET',
requestUri:
'/${Uri.encodeComponent(bucket)}/${key.split('/').map(Uri.encodeComponent).join('/')}?torrent',
headers: headers,
exceptionFnMap: _exceptionFns,
);
return GetObjectTorrentOutput(
body: await $result.stream.toBytes(),
requestCharged: _s
.extractHeaderStringValue($result.headers, 'x-amz-request-charged')
?.let(RequestCharged.fromString),
);
}