martinklepsch / s3-beam

🚀 direct-to-S3 uploading using ClojureScript
Eclipse Public License 1.0
92 stars 17 forks source link

Added a custom key function in server side #6

Closed bensu closed 9 years ago

bensu commented 9 years ago

Users can now provide a :key-fn to the server handler which given file-name and mime-type will determine the key to use for the S3 file.

Caveat: if the client provides a file my-file.txt and the :key-fn generates a random number as a key (i.e. 12314345), the file location in S3 is given by 12314345, which is what was passed back in the s3-pipe uploaded channel. The file location is no longer sufficient for the client to know which file was successfully uploaded (in case of parallel uploads).

My (non-backwards-compatible) proposal is to put in the uploaded channel all information relevant to the client: both the file object that was uploaded and the response from S3 which contains the :key, :location, :bucket, and :etag.

martinklepsch commented 9 years ago

You're on a roll! :+1:

If you have an example it'd be great if you could add it to the changelog (just use "unreleased" or something like that as heading.)

Also are there any other changes to the Readme required to be in sync with the new message format for the uploaded chan?

bensu commented 9 years ago

Forgot to document! While adding the changes to the README I produced a conflict. After solving it I can't push it into this branch, so I'm opening a new PR with the non-conflict changes in #7