Heavy Computation's Cloudflare toolkit for Clojure.
A thin, batteries-included wrapper over the Cloudflare products we reach for in every webapp. Features are added incrementally:
This namespace is the public entry point and re-exports the high-level API as features land. For the full surface (and the raw signed-HTTP escape hatch), use the per-product namespaces directly.
get/list shadow clojure.core names and are excluded here; refer to them
qualified (e.g. cloudflare/get).
Heavy Computation's Cloudflare toolkit for Clojure. A thin, batteries-included wrapper over the Cloudflare products we reach for in every webapp. Features are added incrementally: - R2 object storage (S3-compatible) -> com.heavycomputation.cloudflare.r2 - Images delivery/upload -> com.heavycomputation.cloudflare.images This namespace is the public entry point and re-exports the high-level API as features land. For the full surface (and the raw signed-HTTP escape hatch), use the per-product namespaces directly. `get`/`list` shadow `clojure.core` names and are excluded here; refer to them qualified (e.g. `cloudflare/get`).
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.
AWS Signature Version 4 signing, pared down to what R2 needs.
Header-based authorization (not presigned query strings), SHA-256 payload
hashing, path-style URLs. No chunked/streaming signature. The crypto is all
JDK-native (java.security, javax.crypto), so this carries no dependency.
sign is pure — timestamps are passed in rather than read from the clock —
which lets it be checked against AWS's published test vectors.
AWS Signature Version 4 signing, pared down to what R2 needs. Header-based authorization (not presigned query strings), SHA-256 payload hashing, path-style URLs. No chunked/streaming signature. The crypto is all JDK-native (`java.security`, `javax.crypto`), so this carries no dependency. `sign` is pure — timestamps are passed in rather than read from the clock — which lets it be checked against AWS's published test vectors.
Just enough XML to talk to S3: pull a tag's text out of a small response document and build the CompleteMultipartUpload request body.
This is deliberately not a general XML library. The documents S3 returns for the handful of operations we use are small, flat, and machine-generated, so a tag scan is enough and avoids a parser dependency.
Just enough XML to talk to S3: pull a tag's text out of a small response document and build the CompleteMultipartUpload request body. This is deliberately *not* a general XML library. The documents S3 returns for the handful of operations we use are small, flat, and machine-generated, so a tag scan is enough and avoids a parser dependency.
Cloudflare R2 object storage.
R2 speaks the S3 API, so this namespace signs requests with AWS Signature V4
and sends them over the JDK's http client (see the internal namespaces) —
no AWS SDK, no dependencies. The public API:
(bucket m) ; build a bucket handle (put bucket key body) ; upload an object, multipart automatically (get-bytes bucket key) ; download; also head/exists?/get/get-stream (delete bucket key) ; remove; also delete-many for batches (list bucket opts) ; enumerate by prefix; also list-seq (lazy) (presigned-url bucket k) ; time-limited download/upload URL (request bucket req) ; escape hatch to the raw signed-S3 surface
put hides the single-PUT vs. multipart decision: small objects go up in one
request, large objects (and unknown-length streams) are split into parts that
upload concurrently and retry individually, so a network blip only costs the
part that failed rather than the whole transfer.
get/head/list shadow clojure.core names, so this namespace excludes
them; refer to it qualified (e.g. r2/get).
Cloudflare R2 object storage. R2 speaks the S3 API, so this namespace signs requests with AWS Signature V4 and sends them over the JDK's http client (see the `internal` namespaces) — no AWS SDK, no dependencies. The public API: (bucket m) ; build a bucket handle (put bucket key body) ; upload an object, multipart automatically (get-bytes bucket key) ; download; also head/exists?/get/get-stream (delete bucket key) ; remove; also delete-many for batches (list bucket opts) ; enumerate by prefix; also list-seq (lazy) (presigned-url bucket k) ; time-limited download/upload URL (request bucket req) ; escape hatch to the raw signed-S3 surface `put` hides the single-PUT vs. multipart decision: small objects go up in one request, large objects (and unknown-length streams) are split into parts that upload concurrently and retry individually, so a network blip only costs the part that failed rather than the whole transfer. `get`/`head`/`list` shadow `clojure.core` names, so this namespace excludes them; refer to it qualified (e.g. `r2/get`).
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 |