Skip to content

feat(unstable): Deno.S3Client and Deno.s3#35180

Draft
bartlomieju wants to merge 1 commit into
mainfrom
feat/unstable-s3
Draft

feat(unstable): Deno.S3Client and Deno.s3#35180
bartlomieju wants to merge 1 commit into
mainfrom
feat/unstable-s3

Conversation

@bartlomieju

Copy link
Copy Markdown
Member

Adds a built-in client for S3-compatible object storage (AWS S3, MinIO,
Cloudflare R2, Backblaze B2, etc.) behind --unstable-s3, so objects can
be read, written, listed and presigned without pulling in a third-party
SDK:

const s3 = new Deno.S3Client({ bucket: "my-bucket" });
await s3.write("hello.txt", "hello world");
const text = await s3.file("hello.txt").text();
const url = await s3.presign("hello.txt", { expiresIn: 3600 });

It is implemented as a JS-only lazy loaded extension (ext/s3, no new ops)
on top of fetch and WebCrypto: requests are signed with AWS Signature
Version 4 (header auth for requests, query auth for presigned URLs), and
streaming writes go through multipart uploads. Configuration falls back to
the usual S3_*/AWS_* environment variables, and a default
env-configured client is exposed as Deno.s3. Network access requires
--allow-net; environment fallbacks only require --allow-env when
explicit options are not provided.

Verified against a mock S3 server that re-computes both signature flavors
server-side, covering round-trips (text/JSON/binary/Blob/stream), keys
needing URI escaping, ranged reads via slice(), a 12 MiB multipart
upload, ListObjectsV2 paging, presigned GET/PUT consumed by plain fetch,
and s3://bucket/key paths.

Adds a built-in client for S3-compatible object storage behind
--unstable-s3, implemented as a JS-only lazy loaded extension (ext/s3)
on top of fetch and WebCrypto (AWS Signature Version 4).
@iuioiua

iuioiua commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

This feels like the runtime doing too much, which I think Bun gets wrong 😕

@Hajime-san

Copy link
Copy Markdown
Contributor

Please do not rely on third party closed source services.

AWS S3 may appear to be a stable interface, but it is being updated day by day.
https://docs.aws.amazon.com/AmazonS3/latest/userguide/WhatsNew.html

There have been breaking changes in the past.

Bun's S3 API is already abandoned due to its difficulties of testing.

I predict that this API will become unusable in three years while it may seem convenient now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants