You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/content/docs/2.features/blob.md
+128-4Lines changed: 128 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -390,7 +390,7 @@ Returns a [`BlobObject`](#blobobject) or an array of [`BlobObject`](#blobobject)
390
390
391
391
Throws an error if `file` doesn't meet the requirements.
392
392
393
-
<!--### `handleMultipartUpload()`
393
+
### `handleMultipartUpload()`
394
394
395
395
Handle the request to support multipart upload.
396
396
@@ -437,7 +437,10 @@ See [`useMultipartUpload()`](#usemultipartupload) on usage details.
437
437
### `createMultipartUpload()`
438
438
439
439
::note
440
-
We suggest to use [`handleMultipartUpload()`](#handlemultipartupload) method to handle the multipart upload request.
440
+
We suggest using [`handleMultipartUpload()`](#handlemultipartupload) method to handle the multipart upload request.
441
+
:br
442
+
:br
443
+
If you want to handle multipart uploads manually using this utility, keep in mind that you cannot use this utility for Vercel Blob due to payload size limit of Vercel functions. Consider using [Vercel Blob Client SDK](https://vercel.com/docs/vercel-blob/client-upload).
441
444
::
442
445
443
446
Start a new multipart upload.
@@ -484,7 +487,7 @@ Returns a `BlobMultipartUpload`
484
487
### `resumeMultipartUpload()`
485
488
486
489
::note
487
-
We suggest to use [`handleMultipartUpload()`](#handlemultipartupload) method to handle the multipart upload request.
490
+
We suggest using[`handleMultipartUpload()`](#handlemultipartupload) method to handle the multipart upload request.
488
491
::
489
492
490
493
Continue processing of unfinished multipart upload.
@@ -595,7 +598,7 @@ Returns a `BlobMultipartUpload`
595
598
::field{name="event"type="H3Event"required}
596
599
The event to handle.
597
600
::
598
-
::-->
601
+
::
599
602
600
603
## `ensureBlob()`
601
604
@@ -697,6 +700,10 @@ const data = await completed
697
700
698
701
Application composable that creates a multipart upload helper.
699
702
703
+
::important
704
+
When you configure to use Vercel Blob, this utility will automatically use [Vercel Blob Client SDK](https://vercel.com/docs/vercel-blob/client-upload) to upload the file.
NuxtHub supports multiple storage providers for blob storage. In development mode, NuxtHub automatically configures the filesystem (`fs`) driver for local development.
752
+
753
+
### Filesystem (fs)
754
+
755
+
The filesystem driver stores blobs locally on your development machine.
756
+
757
+
```ts [nuxt.config.ts]
758
+
exportdefaultdefineNuxtConfig({
759
+
nitro: {
760
+
storage: {
761
+
BLOB: {
762
+
driver: 'fs',
763
+
base: './.data/blob'
764
+
}
765
+
}
766
+
}
767
+
})
768
+
```
769
+
770
+
### Vercel Blob
771
+
772
+
For production deployments on Vercel, use the Vercel Blob driver.
773
+
774
+
```ts [nuxt.config.ts]
775
+
exportdefaultdefineNuxtConfig({
776
+
nitro: {
777
+
storage: {
778
+
BLOB: {
779
+
driver: 'vercel-blob',
780
+
access: 'public'
781
+
}
782
+
}
783
+
}
784
+
})
785
+
```
786
+
787
+
### Cloudflare R2
788
+
789
+
For Cloudflare deployments, you can use Cloudflare R2 with either bindings (recommended) or the S3-compatible driver.
790
+
791
+
#### Using R2 Bindings (Recommended)
792
+
793
+
When deploying to Cloudflare Workers, use R2 bindings for optimal performance and integration.
794
+
795
+
```ts [nuxt.config.ts]
796
+
exportdefaultdefineNuxtConfig({
797
+
nitro: {
798
+
storage: {
799
+
BLOB: {
800
+
driver: 'cloudflare-r2',
801
+
binding: 'BLOB'
802
+
}
803
+
}
804
+
}
805
+
})
806
+
```
807
+
808
+
Make sure to configure the R2 binding in your `wrangler.toml`:
809
+
810
+
```toml [wrangler.toml]
811
+
[[r2_buckets]]
812
+
binding = "BLOB"
813
+
bucket_name = "my-bucket"
814
+
```
815
+
816
+
#### Using S3-Compatible Driver
817
+
818
+
Alternatively, you can use the S3-compatible driver with Cloudflare R2. This is useful for deploying your project in different environments while still using Cloudflare R2.
0 commit comments