Skip to content

Commit

Permalink
chore(docs): methods params
Browse files Browse the repository at this point in the history
  • Loading branch information
smarroufin committed Feb 26, 2024
1 parent 66d8c9e commit 394a044
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 41 deletions.
6 changes: 3 additions & 3 deletions docs/content/docs/1.getting-started/2.installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ export default defineNuxtConfig({

::field-group
::field{name="remote" type="boolean"}
Default to `false` - Allows working with remote storage (database, kv, blob) from your deployed project. :br
You can set `NUXT_HUB_REMOTE=true` in your `.env` file to enable the remote option.:br
Or use the `--remote` flag when running your Nuxt project locally (e.g. `nuxt dev --remote`).
Default to `false` - Allows working with remote storage (database, kv, blob) from your deployed project. :br
You can set `NUXT_HUB_REMOTE=true` in your `.env` file to enable the remote option.:br
Or use the `--remote` flag when running your Nuxt project locally (e.g. `nuxt dev --remote`).
::
::

Expand Down
95 changes: 57 additions & 38 deletions docs/content/docs/2.storage/3.blob.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,20 @@ export default eventHandler(async () => {

#### Params

- `options`: [`BlobListOptions`](#bloblistoptions)
::field-group
::field{name="options" type="Object"}
The list options.
::field{name="limit" type="Number"}
The maximum number of blobs to return per request. Defaults to `1000`.
::
::field{name="prefix" type="String"}
Filters the results to only those that begin with the specified prefix.
::
::field{name="cursor" type="String"}
The cursor to continue from a previous list operation.
::
::
::

#### Return

Expand All @@ -43,8 +56,14 @@ export default eventHandler(async (event) => {

#### Params

- `event`: [`H3Event`](https://github.com/unjs/h3){target=_blank}
- `pathname`: `string`
::field-group
::field{name="event" type="H3Event"}
Handler's event, needed to set headers.
::
::field{name="pathname" type="String"}
The name of the blob to serve.
::
::

#### Return

Expand All @@ -68,7 +87,11 @@ const blob = await useBlob().head(pathname)

#### Params

- `pathname`: `string`
::field-group
::field{name="pathname" type="String"}
The name of the blob to serve.
::
::

#### Return

Expand Down Expand Up @@ -96,9 +119,26 @@ export default eventHandler(async (event) => {

#### Params

- `pathname`: `string`
- `body`: `string` | `ReadableStream<any>` | `ArrayBuffer` | `ArrayBufferView` | `Blob`
- `options`: [`BlobPutOptions`](#blobputoptions)
::field-group
::field{name="pathname" type="String"}
The name of the blob to serve.
::
::field{name="body" type="String | ReadableStream<any> | ArrayBuffer | ArrayBufferView | Blob"}
The blob's data.
::
::field{name="options" type="Object"}
The put options. Any other provided field will be stored in the blob's metadata.
::field{name="contentType" type="String"}
The content type of the blob. If not given, it will be inferred from the Blob or the file extension.
::
::field{name="contentLength" type="String"}
The content length of the blob.
::
::field{name="addRandomSuffix" type="Boolean"}
If `true`, a random suffix will be added to the blob's name. Defaults to `false`.
::
::
::

#### Return

Expand All @@ -120,7 +160,11 @@ export default eventHandler(async (event) => {

#### Params

- `pathname`: `string`
::field-group
::field{name="pathname" type="String"}
The name of the blob to serve.
::
::

#### Return

Expand All @@ -140,17 +184,17 @@ ensureBlob(file, { maxSize: '1MB', types: ['image' ]})

::field-group
::field{name="file" type="Blob" required}
The file to validate.
The file to validate.
::
::field{name="options" type="Object" required}
Note that at least `maxSize` or `types` should be provided.
::field{name="maxSize" type="BlobSize"}
The maximum size of the file, should be: :br
(`1` | `2` | `4` | `8` | `16` | `32` | `64` | `128` | `256` | `512` | `1024`) + (`B` | `KB` | `MB` | `GB`) :br
e.g. `'512KB'`, `'1MB'`, `'2GB'`, etc.
The maximum size of the file, should be: :br
(`1` | `2` | `4` | `8` | `16` | `32` | `64` | `128` | `256` | `512` | `1024`) + (`B` | `KB` | `MB` | `GB`) :br
e.g. `'512KB'`, `'1MB'`, `'2GB'`, etc.
::
::field{name="types" type="BlobType[]"}
Allowed types of the file, e.g. `['image/jpeg']`.
Allowed types of the file, e.g. `['image/jpeg']`.
::
::
::
Expand All @@ -163,31 +207,6 @@ Throws an error if `file` doesn't meet the requirements.

## Types

### `BlobListOptions`

```ts
interface BlobListOptions {
/**
* The maximum number of blobs to return per request.
* @default 1000
*/
limit?: number
prefix?: string
cursor?: string
}
```

### `BlobPutOptions`

```ts
interface BlobPutOptions {
contentType?: string,
contentLength?: string,
addRandomSuffix?: boolean,
[key: string]: any
}
```

### `BlobObject`

```ts
Expand Down

0 comments on commit 394a044

Please sign in to comment.