I'm aware that an object can be read from S3 using aws.s3 library
in R. How do I find object size without reading it into R
?
You may try using the head_object
function from the aws.s3
package:
head_object(object, bucket, ...)
head_object checks whether an object exists by executing an HTTP HEAD request; this can be useful for checking object headers such as “content-length” or “content-type”.
If you poke around the AWS documentation for the HEAD object, you will see that a HEAD request is identical to a full GET request, except that the body will be empty. But, the content length header should be there, ideally telling you how large the object is. This information should be available in the returned R object.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With