cloudyr / aws.s3

Amazon Simple Storage Service (S3) API Client
https://cloud.r-project.org/package=aws.s3
381 stars 148 forks source link

Allow reading an object through R connection #197

Closed yasushi-saito closed 6 years ago

yasushi-saito commented 6 years ago

We have a package that reads data through a connection and we are looking for a way to feed S3 files to it. Do you have a plan to add such a support? If that's too complicated, at least we want a way to read a particular byte range of an object.

kaneplusplus commented 6 years ago

You can either save it to disk using save_object and open a connection. Or, for raw and text data, you can call rawConnection or textConnection on the return of get_object.

leeper commented 6 years ago

You can grab particular bytes by passing a header argument. There's an example in get_object() documentation: https://github.com/cloudyr/aws.s3/blob/master/R/get_object.R#L37

Or you can do as @kaneplusplus suggests and use a rawConnection() of the raw vector returned by get_object().