S3 driver allows storing KV data to Amazon S3 or any other S3-compatible provider.
Driver implementation is lightweight and based on fetch working with Node.js as well as edge workers.
Driver name: s3
Setup a "Bucket" in your S3-compatible provider. You need this info:
Make sure to install required peer dependencies:
npm i aws4fetch
yarn add aws4fetch
pnpm i aws4fetch
bun i aws4fetch
deno i npm:aws4fetch
Then please make sure to set all driver's options:
import { createStorage } from "unstorage";
import s3Driver from "unstorage/drivers/s3";
const storage = createStorage({
driver: s3Driver({
accessKeyId: "", // Access Key ID
secretAccessKey: "", // Secret Access Key
endpoint: "",
bucket: "",
region: "",
}),
});
Options:
bulkDelete: Enabled by default to speedup clear() operation. Set to false if provider is not implementing DeleteObject.Any S3-compatible provider should work out of the box. Pull-Requests are more than welcome to add info about other any other tested provider.
Options:
endpoint to https://s3.[region].amazonaws.com/Options:
endpoint to https://[uid].r2.cloudflarestorage.com/region to auto