v1.2.2 — 2026-06-07
Object storage: AWS S3, OpenStack Swift, and Azure Blob Storage. GCS is supported via S3 interoperability mode.
# Debian/Ubuntu
sudo apt install libcurl4-openssl-dev libssl-dev
# macOS
brew install curl opensslEnable: -DBUILD_MODULE_STORAGE=ON (off by default).
(import (curry storage))Supports AWS S3, Cloudflare R2, MinIO, Ceph, and any S3-compatible endpoint. Authentication uses AWS Signature Version 4 (HMAC-SHA256 signing chain).
(s3-client access-key secret-key region)
(s3-client access-key secret-key region endpoint) ; custom endpointendpointdefaults tohttps://s3.amazonaws.com. Override for non-AWS services.- Returns an opaque client handle.
(s3-put! client bucket key data)
(s3-put! client bucket key data content-type) ; optional content-type stringUpload data (string or bytevector) to bucket/key. Returns #t on success.
(s3-get client bucket key) ; → string (body) or #f on error
(s3-delete! client bucket key) ; → #t on success(import (curry storage))
(define s3 (s3-client "AKIAIOSFODNN7EXAMPLE"
"wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"
"us-east-1"))
(s3-put! s3 "my-bucket" "data/hello.txt" "Hello, world!" "text/plain")
(display (s3-get s3 "my-bucket" "data/hello.txt"))
; => "Hello, world!"
(s3-delete! s3 "my-bucket" "data/hello.txt")(define r2 (s3-client "r2-access-key" "r2-secret-key" "auto"
"https://<account-id>.r2.cloudflarestorage.com"))(define minio (s3-client "minioadmin" "minioadmin" "us-east-1"
"http://localhost:9000"))Enable HMAC keys in GCS, then:
(define gcs (s3-client "GOOGHMAC..." "secret..." "auto"
"https://storage.googleapis.com"))(swift-client auth-url tenant username password)
(swift-client auth-url tenant username password endpoint-override)Authenticates with Keystone v3 (token-based). Returns a client handle.
(swift-put! client container object data)
(swift-put! client container object data content-type)
(swift-get client container object) ; → string or #f(import (curry storage))
(define swift (swift-client "https://keystone.example.com/v3"
"my-project"
"alice"
"password"))
(swift-put! swift "backups" "db-2024-01-01.sql.gz" backup-data "application/gzip")
(define data (swift-get swift "backups" "db-2024-01-01.sql.gz"))(azure-client account-name account-key)Authenticates using Shared Key (HMAC-SHA256 of the canonicalized request). Returns a client handle.
(azure-put! client container blob data)
(azure-put! client container blob data content-type)
(azure-get client container blob) ; → string or #f
(azure-delete! client container blob) ; → #t(import (curry storage))
(define az (azure-client "mystorageaccount"
"base64-encoded-account-key=="))
(azure-put! az "simulation-results" "run-001.json"
(json-stringify results) "application/json")- All transfers are synchronous (blocking). Use actors for concurrent uploads.
- Data can be a string (treated as UTF-8 bytes) or a bytevector.
- Error handling: on HTTP errors the procedure returns
#f. For detailed errors, check stderr output from libcurl (setCURLOPT_VERBOSEby patching the C source if needed). - Multipart upload for large objects (>5 GB for S3) is not implemented; split large data manually.
- The signing logic for S3 (AWS Sig V4) is implemented in pure C without depending on any AWS SDK.