Drivers
S3
Store data to storage to S3-compatible providers.
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.
Setup
Setup a "Bucket" in your S3-compatible provider. You need this info:
- Access Key ID
- Secret Access Key
- Bucket name
- Endpoint
- Region
Make sure to install required peer dependencies:
npm i 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 speedupclear()
operation. Set tofalse
if provider is not implementing DeleteObject.
Tested providers
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.
Amazon S3
Options:
- Set
endpoint
tohttps://s3.[region].amazonaws.com/
Cloudflare R2
Options:
- Set
endpoint
tohttps://[uid].r2.cloudflarestorage.com/
- Set
region
toauto