Skip to content

ByteRange is not working in IAmzonS3.GetObjectAsync #2523

Discussion options

You must be logged in to vote

@ElectricVampire Thanks for opening the issue. Upon analysis, it appears that if you don't specify the upper bound, it defaults from the starting byte to the end byte of the object. For instance, the below code:

using Amazon.S3;
using Amazon.S3.Model;

var _clientAmazonS3 = new AmazonS3Client();

var downloadRequest = new GetObjectRequest()
{
    Key = "<<some-key>>",
    BucketName = "<<some-bucket>>",
    ByteRange = new ByteRange("bytes=1000-")
};
GetObjectResponse s3Response = await _clientAmazonS3.GetObjectAsync(downloadRequest);

Console.WriteLine($"Content Length: {s3Response.ContentLength}, Content Range: {s3Response.ContentRange}");

returns

  • s3Response.ContentRange as bytes 1000-…

Replies: 2 comments 7 replies

Comment options

You must be logged in to vote
7 replies
@ElectricVampire
Comment options

@ashishdhingra
Comment options

@ElectricVampire
Comment options

@ashishdhingra
Comment options

@ElectricVampire
Comment options

Answer selected by ashishdhingra
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
guidance Question that needs advice or information. response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. s3
2 participants
Converted from issue

This discussion was converted from issue #2520 on January 18, 2023 23:08.