Skip to content

useStorageSignedUrlWithOptions

useStorageSignedUrlWithOptions(bucket, path, options?): UseQueryResult<null | string, Error>

Hook to create a signed URL with full options including image transformations

ParameterTypeDescription
bucketstringThe storage bucket name
pathnull | stringThe file path (or null to disable)
options?SignedUrlOptionsSigned URL options including expiration and transforms

UseQueryResult<null | string, Error>

function SecureThumbnail({ path }: { path: string }) {
const { data: url } = useStorageSignedUrlWithOptions('images', path, {
expiresIn: 3600,
transform: {
width: 400,
height: 300,
format: 'webp',
quality: 85,
fit: 'cover'
}
});
return <img src={url || ''} alt="Secure Thumbnail" />;
}