Skip to content

Commit

Permalink
docs(s3): Mention required headers on setItemRaw
Browse files Browse the repository at this point in the history
  • Loading branch information
becem-gharbi committed Jan 16, 2024
1 parent 967a971 commit 6540535
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions docs/content/6.drivers/s3.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# S3

This driver allows data storage to Amazon S3 compatible services. The data can be KV for document storage or Binary for file storage. It uses a direct HTTP client for a lightweight bundle size and compatibility with edge environments such as Cloudflare Workers and Netlify Edge Functions.
This driver allows data storage to Amazon S3 compatible providers. The data can be KV for document storage or Binary for file storage. It implements a direct HTTP client for a lightweight bundle size and compatibility with edge environments such as Cloudflare Workers and Netlify Edge Functions.

#### Setup

First make sure to create a Bucket and an Access key with permissions for Object Read & Write. This key will be used for the following Object-level operations [HeadObject](https://docs.aws.amazon.com/AmazonS3/latest/API/API_HeadObject.html), [ListObjectsV2](https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListObjectsV2.html), [GetObject](https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetObject.html), [PutObject](https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutObject.html), [DeleteObject](https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeleteObject.html), [DeleteObjects](https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeleteObjects.html).
To start please make sure to create a Bucket and an access key with permissions for Object Read & Write. This key will be used for the following object-level operations [HeadObject](https://docs.aws.amazon.com/AmazonS3/latest/API/API_HeadObject.html), [ListObjectsV2](https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListObjectsV2.html), [GetObject](https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetObject.html), [PutObject](https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutObject.html), [DeleteObject](https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeleteObject.html), [DeleteObjects](https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeleteObjects.html).

Then make sure to provide the driver's options.
Then please make sure to set the driver's options.

```ts
import { createStorage } from "unstorage";
Expand All @@ -29,9 +29,9 @@ const storage = createStorage({
This driver supports the following methods

- `getItem`/`getItemRaw` To retreive KV or Binary data respectively. Note that the internal response headers can be retreived from `headers` option.
- `setItem`/`setItemRaw` To upload KV or Binary data respectively. Note that the internal request headers can be extended by `headers` option.
- `setItem`/`setItemRaw` To upload KV or Binary data respectively. Note that the internal request headers can be extended by `headers` option. On `setItemRaw` it's recommended to set `Content-Length` and `Content-Type` headers as they may not be automatically resolved by the provider.
- `removeItem` To delete a single Object.
- `clear` To delete multiple Objects. Note that if `accountId` config option is provided then **DeleteObjects** operation is performed. Otherwise multiple **DeleteObject** operations are performed. This is because **DeleteObjects** operation may not be supported by the provider.
- `getMeta` To retreive the user-defined metadata. Note that `setMeta` is not supported because metadata can only be set on upload (`setItem`/`setItemRaw`) via `meta` option.
- `getKeys` Get Object's keys.
- `getKeys` Gets the keys of objects in a specific folder.
- `hasItem` Checks if Object exists.

0 comments on commit 6540535

Please sign in to comment.