Skip to content

Instantly share code, notes, and snippets.

@djmnz
Last active December 19, 2023 09:56
Show Gist options
  • Save djmnz/8190656 to your computer and use it in GitHub Desktop.
Save djmnz/8190656 to your computer and use it in GitHub Desktop.
Getting object size from C# AWS SDK without downloading it
using (var amazonClient = new AmazonS3Client())
{
var getObjectMetadataRequest = new GetObjectMetadataRequest() { BucketName = RawBucketName, Key = fileName };
var meta = amazonClient.GetObjectMetadata(getObjectMetadataRequest);
var fileSize = meta.Headers.ContentLength;
}
@adityaanugrohoo
Copy link

Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment