jcberquist / aws-cfml

Lucee/ColdFusion library for interacting with AWS API's
MIT License
72 stars 53 forks source link

How to deal with getObject Response? #31

Closed umairkhan125 closed 1 year ago

umairkhan125 commented 4 years ago

Hi

I am currently using getObject but do not know how to load the s3 file on my website for view. ?

jcberquist commented 4 years ago

I am not sure I follow your question. If you have gotten the object from S3 using this library, then it will be available in the response struct under the rawData key. If you want to send that file to the browser you could then use the <cfcontent> tag (https://cfdocs.org/cfcontent).

Daemach commented 1 year ago

GetObject is confusing because I expect to define a path to which to write the file I'm retrieving. Additionally, because some of the files I need to pull, like database backups, can be 100GB+, streaming them to a local file is the best solution. Is this possible?

jcberquist commented 1 year ago

As noted in the comment above, getObject retrieves the entire object and holds it in memory, it is available via the rawData key in the response. To get the downloaded object on disk you would need to fileWrite() the rawData to disk.

For your use case this would obviously not be a valid approach. There is no support for streaming objects directly to disk via this library. If you need to do this via CFML you might consider loading and using the AWS Java SDK. I think that the S3TransferManager can do what you are looking for.