useStorageUploadWithProgress
useStorageUploadWithProgress(
bucket):object
Hook to upload a file to a bucket with built-in progress tracking
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
bucket | string |
Returns
Section titled “Returns”object
| Name | Type | Default value |
|---|---|---|
progress | null | UploadProgress | - |
reset | () => void | - |
upload | UseMutationResult<null | object, Error, object, unknown> | mutation |
Example
Section titled “Example”const { upload, progress, reset } = useStorageUploadWithProgress('avatars')
// Upload with automatic progress trackingupload.mutate({ path: 'user.jpg', file: file})
// Display progressconsole.log(progress) // { loaded: 1024, total: 2048, percentage: 50 }