A tiny, zero-dependency S3 client: signs each request with SigV4 and sends it
over the JDK's java.net.http client. It is path-style and stateless — just
the transport R2 needs, with no per-operation knowledge baked in.
A tiny, zero-dependency S3 client: signs each request with SigV4 and sends it over the JDK's `java.net.http` client. It is path-style and stateless — just the transport R2 needs, with no per-operation knowledge baked in.
(client {:keys [endpoint region access-key-id secret-access-key http-client]})Build an S3 client handle. :endpoint is the scheme+host base URL (no
trailing slash); :region/:access-key-id/:secret-access-key configure
SigV4. An :http-client may be supplied to share a JDK client; otherwise one
is created.
Build an S3 client handle. `:endpoint` is the scheme+host base URL (no trailing slash); `:region`/`:access-key-id`/`:secret-access-key` configure SigV4. An `:http-client` may be supplied to share a JDK client; otherwise one is created.
(default-http-client)(header resp name)First value of response header name (case-insensitive), or nil.
First value of response header `name` (case-insensitive), or nil.
(presign {:keys [endpoint host region service access-key-id secret-access-key]}
{:keys [method path query expires]})Build a presigned URL (SigV4 query-string auth) for req
({:method :path :query :expires}). :method is the HTTP verb the URL will
be used with; :expires is the validity window in seconds.
Build a presigned URL (SigV4 query-string auth) for `req`
(`{:method :path :query :expires}`). `:method` is the HTTP verb the URL will
be used with; `:expires` is the validity window in seconds.(send-request client req)Sign and send one request. req:
:method "GET" | "PUT" | "POST" | "DELETE" | "HEAD"
:path path-style path, e.g. "/bucket/key"
:query map of query params (optional)
:headers map of extra headers to sign+send (optional)
:body byte[] payload (optional; defaults to empty)
Returns {:status int :headers {lower-name [vals]} :body byte[]} for any
completed exchange (including 4xx/5xx). Network failures throw IOException.
Sign and send one request. `req`:
:method "GET" | "PUT" | "POST" | "DELETE" | "HEAD"
:path path-style path, e.g. "/bucket/key"
:query map of query params (optional)
:headers map of extra headers to sign+send (optional)
:body byte[] payload (optional; defaults to empty)
Returns `{:status int :headers {lower-name [vals]} :body byte[]}` for any
completed exchange (including 4xx/5xx). Network failures throw IOException.(send-streaming client req)Like send-request, but :body in the result is an InputStream rather than
a buffered byte[] — for downloading large objects without holding them in
memory. The caller must close (or fully consume) :body.
Like `send-request`, but `:body` in the result is an InputStream rather than a buffered byte[] — for downloading large objects without holding them in memory. The caller must close (or fully consume) `:body`.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |