Skip to content

Instantly share code, notes, and snippets.

@malcolmsparks
Created May 29, 2017 15:47
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save malcolmsparks/e30b0338c054c29cfda730a4b597aa1b to your computer and use it in GitHub Desktop.
Save malcolmsparks/e30b0338c054c29cfda730a4b597aa1b to your computer and use it in GitHub Desktop.
(resource
{:id ::index
:methods
{:post
{:consumes "application/octet-stream"
:consumer (fn [ctx _ body-stream]
(let [f (java.io.File/createTempFile "yada" ".tmp" (io/file "/tmp"))]
(infof "Saving to file: %s" f)
(save-to-file
ctx body-stream
f)))
:response (fn [ctx] (format "Thank you, saved upload content to file: %s\n" (:file ctx)))}}})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment