2.0 beta — new releases can include breaking changes. Stable 1.x docs
dimah-s3v2.0.0-beta.0

React Client

Headless React client for S3 upload, download, and delete flows.

@dimah-s3/react is the headless React client for dimah-s3. It handles file intake, validation, progress, retries, cancel, and multipart transfers, and leaves the UI to you.

Uploads and, by default, downloads run directly between the browser and the bucket. Credentials stay on the server: the client sends a route name, and the server picks the object key.

Key features

  • Per-key state — Each file or object key has its own operation, so lists can show many transfers at once.
  • Outcomes, not throws — Every action resolves with an outcome or a result. Errors are APIErrors with stable codes.
  • Upload queue — Validated files upload a few at a time, and each can be cancelled on its own.
  • Multipart and resume — Large files upload in parts the server lays out, and can resume with an UploadStore.
  • Server-owned policy — Accepted types, size limits, multipart, and checksums come from the server's route catalog.
  • Ready-made UI — Optional accessible shadcn components built on these hooks.
  • Backend agnostic — Use @dimah-s3/server, or implement the S3Api contract yourself.

Entries

The package has two entries:

  • @dimah-s3/react — hooks, S3Provider, createS3Client, the formatter hooks, and types. Its build is marked "use client".
  • @dimah-s3/react/engine — plain functions with no React import, such as uploadFile, defineApi, memoryObjectSource, and the stores. Use them in shared or server modules. See Engine.

APIError, S3_ERROR_CODES, validateFile, and the other protocol helpers come from @dimah-s3/core. The React package does not re-export them. It needs React 19.2.

Upgrading from 1.7? See Upgrade to 2.0 beta for the renamed hooks, callbacks, and entries.

Documentation

On this page