S3 icon indicating copy to clipboard operation
S3 copied to clipboard

Get/Read a file on S3

Open aadamsx opened this issue 11 years ago • 4 comments

I have a pdf located in a server side directory. Using a Iron Router route, like 'get-pdf', I read this file with fs node.js (readFileSync) and do a response.write(file), which renders the pdf in the browser. This works. But now what I want to do is read in a file stored on S3 and do a response.write(file-s3).

Is this possible with your package?

aadamsx avatar Jan 24 '15 19:01 aadamsx

It's not as easy as it sounds sadly. I'm not sure if Amazon would support something like that. This is what I'm going to try to implement further down the road so it might be out of the scope of the project.

Lepozepo avatar Mar 13 '15 23:03 Lepozepo

Thanks for the feedback. So, how do you 'get' things store in S3 for use in your website? I mean, it's kinda pointless to have a one way drop bucket of files right? Even if I could get a file stored on S3 and copy it/write it out to my local file system, this I think would be enough. Once it's on my file system I can do what I wish with it.

aadamsx avatar Mar 14 '15 18:03 aadamsx

You use the URL supplied by the callback to get the file basically. So in your application I guess you would upload to S3, save the URL in a collection, then when you modify you would show the user a "loading" indicator while the file is downloaded to your server via the collection URL so that you can make edits via fs, then upload and replace on S3 after it's done. I completely removed my server side uploader though because it was having issues corrupting data. :O

Lepozepo avatar Mar 14 '15 18:03 Lepozepo

Thanks. I think your approach is the path I will take.

aadamsx avatar Mar 14 '15 19:03 aadamsx