@dimah-s3/core
v1.5.9
Published
Typed S3 presign protocol and fetch client shared by @dimah-s3/server and @dimah-s3/react
Maintainers
Readme
@dimah-s3/core
Shared protocol, typed API client, and pure helpers used by @dimah-s3/server and @dimah-s3/react.
Full documentation: s3.dimah.dev/docs/core · llms.txt
Install
pnpm add @dimah-s3/coreMinimal setup
import { createS3Client, APIError } from "@dimah-s3/core";
export const api = createS3Client({
// optional: auth for core routes + client plugins
credentials: "include",
headers: () => ({ Authorization: `Bearer ${token}` }),
});
try {
await api.download({ route: "uploads", key });
} catch (err) {
if (err instanceof APIError)
console.error(err.statusCode, err.code, err.message);
}For React apps, prefer createS3Client from @dimah-s3/react (returns the API
object plus a bound Provider / useApi).
License
MIT
