(formdata-from-pairs coll)
Returns a formdata object with k-v pairs in coll assigned to it. Ordering that you provide for the pairs is respected.
Returns a formdata object with k-v pairs in coll assigned to it. Ordering that you provide for the pairs is respected.
(s3-pipe report-chan)
(s3-pipe report-chan opts)
Takes a channel where completed uploads will be reported as a map and returns a channel where
you can put File objects, or input maps that should get uploaded. (see upload-file
and sign-file
)
May also take an options map with:
:server-url - the signing server url, defaults to "/sign"
:response-parser - a function to process the signing response from the signing server into EDN
defaults to read-string.
:key-fn - a function used to generate the object key for the uploaded file on S3
defaults to nil, which means it will use the passed filename as the object key.
:headers-fn - a function used to create the headers for the GET request to the signing server.
:progress-events? - if true, progress events will be pushed on to channel during upload
defaults to false.
Takes a channel where completed uploads will be reported as a map and returns a channel where you can put File objects, or input maps that should get uploaded. (see `upload-file` and `sign-file`) May also take an options map with: :server-url - the signing server url, defaults to "/sign" :response-parser - a function to process the signing response from the signing server into EDN defaults to read-string. :key-fn - a function used to generate the object key for the uploaded file on S3 defaults to nil, which means it will use the passed filename as the object key. :headers-fn - a function used to create the headers for the GET request to the signing server. :progress-events? - if true, progress events will be pushed on to channel during upload defaults to false.
(sign-file server-url edn-ize key-fn headers-fn input-map-or-file ch)
Takes a server-url
and a fn edn-ize
which is for interpreting the server response text into edn.
Takes a key-fn
function that takes one argument (the filename) and generates a object-key to
use to create the file on S3.
Also takes an input map with:
:file - A File
object
:identifier (optional) - A variable used to uniquely identify this file upload.
This will be included in the response channel.
:key (optional) - The file-name parameter that is sent to the signing server. If a :key key
exists in the input-map it will be used instead of the key-fn as an object-key.
:metadata (optional) - Metadata for the object. See http://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectPOST.html
for full details on which keys are supported. Keys and values can be strings or keywords.
N.B. Keys not on that list will not be accepted. If you want to set arbitrary metadata,
it needs to be prefixed with x-amz-meta-*
.
Sends the request to the server-url to be signed.
Takes a `server-url` and a fn `edn-ize` which is for interpreting the server response text into edn. Takes a `key-fn` function that takes one argument (the filename) and generates a object-key to use to create the file on S3. Also takes an input map with: :file - A `File` object :identifier (optional) - A variable used to uniquely identify this file upload. This will be included in the response channel. :key (optional) - The file-name parameter that is sent to the signing server. If a :key key exists in the input-map it will be used instead of the key-fn as an object-key. :metadata (optional) - Metadata for the object. See http://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectPOST.html for full details on which keys are supported. Keys and values can be strings or keywords. N.B. Keys not on that list will not be accepted. If you want to set arbitrary metadata, it needs to be prefixed with `x-amz-meta-*`. Sends the request to the server-url to be signed.
(upload-file {:keys [progress-events?] :as opts}
{:keys [f identifier form-data upload-url] :as upload-info}
ch)
Take the signature information upload-info
, and a response channel ch
,
and does the S3 upload.
Upon success it responds on the response channel with a map with:
:type - :success for success events
:file - the File that was uploaded
:response - a map of S3 metadata: :key, :location, :bucket, :etag
:identifier - an identifier pass-through value for caller to identify the file with
If the upload-info has an :error-code key because the signing failed, skips the xhr/send of the file,
and simply replies with the error messages and codes from the failed upload-info sign attempt.
If progress-events are enabled, it responds on the response channel with a map with
:type - :progress
:file - the File that was uploaded
:bytes-sent - the size of the already uploaded potion in bytes
:bytes-total - the total file size in bytes
:identifier - an identifier pass-through value for caller to identify the file with
Take the signature information `upload-info`, and a response channel `ch`, and does the S3 upload. Upon success it responds on the response channel with a map with: :type - :success for success events :file - the File that was uploaded :response - a map of S3 metadata: :key, :location, :bucket, :etag :identifier - an identifier pass-through value for caller to identify the file with If the upload-info has an :error-code key because the signing failed, skips the xhr/send of the file, and simply replies with the error messages and codes from the failed upload-info sign attempt. If progress-events are enabled, it responds on the response channel with a map with :type - :progress :file - the File that was uploaded :bytes-sent - the size of the already uploaded potion in bytes :bytes-total - the total file size in bytes :identifier - an identifier pass-through value for caller to identify the file with
(xml->map xml)
Transforms a shallow XML document into a map.
Transforms a shallow XML document into a map.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close