benjreinhart / react-native-aws3

Pure JavaScript React Native library for uploading to AWS S3
MIT License
400 stars 151 forks source link

New features #2

Open kelong opened 8 years ago

kelong commented 8 years ago

Hey,

Very good library, thanks ! I also need fast get and deleteObject very fast :) I added get function:

`static get(fileUrl, options, type) { options = Object.assign({}, options, { key: (options.keyPrefix || ''), contentType: type });

  let url = `http://${ options.bucket }.s3.amazonaws.com/${ fileUrl }`;
  let method = "GET";
  let policy = S3Policy.generate(options);

  return Request.create(url, method, policy)
    .send()
    .then(setBodyAsParsedXML);

}` But it doesnt work. Any suggestions ? Thanks.

benjreinhart commented 8 years ago

Hey Kelong,

Thanks for trying out the lib!

It doesn't work because the policy is generated differently for the PutObject calls given we're following the Browser Based Uploads approach.

However, I have a branch for generating pre-signed URLs which would be used with GetObject and DeleteObject calls here. Unfortunately, that branch isn't currently working but it must be very close, as I followed amazon's docs as closely as I could. Until I get that working, that'll be your best bet. Feel free to submit a PR if you get it working :)

Others have asked me for that functionality as well so I will try to get to it soon.

Thanks!

kelong commented 8 years ago

Thank you very much. Will try to do something, but I am new to this ;)

Thanks.

kelong commented 8 years ago

Hey, Any progress ? Thanks.

benjreinhart commented 8 years ago

I unfortunately haven't been able to get to it yet. I'll try to take another pass this weekend if I can.

kelong commented 8 years ago

Ok, thank you very much.

kelong commented 8 years ago

Still no luck ? :(

faceyspacey commented 8 years ago

any word?

stantoncbradley commented 8 years ago

presigned posts would be phenomenal! god speed @benjreinhart!

dcworldwide commented 8 years ago

Did anyone find a solution?

I don't mind submitting a PR, but as I'm new to s3, can someone detail what I'll need to do?

j4p3 commented 8 years ago

Also working on presigned posts. I've used them with straight form-data but RN is proving to be tougher.

edoantonioco commented 5 years ago

a way to get objects from the bucket is very much needed