Create a signed URL
Creates a signed URL. Use a signed URL to share a file for a fixed amount of time.
- RLS policy permissions required:
buckets
table permissions: noneobjects
table permissions:select
- Refer to the Storage guide on how access control works
Parameters
- pathREQUIREDstring
The file path, including the current file name. For example `folder/image.png`.
- expiresInREQUIREDnumber
The number of seconds until the signed URL expires. For example, `60` for a URL which is valid for one minute.
- optionsOptionalobjectdownloadOptionalstring | boolean
triggers the file as a download if set to true. Set this parameter as the name of the file if you want to trigger the download with a different filename.
transformOptionalTransformOptionsTransform the asset before serving it to the client.
formatOptional"origin"Specify the format of the image requested. When using 'origin' we force the format to be the same as the original image. When this option is not passed in, images are optimized to modern image formats like Webp.
heightOptionalnumberThe height of the image in pixels.
qualityOptionalnumberSet the quality of the returned image. A number from 20 to 100, with 100 being the highest quality. Defaults to 80
resizeOptional"cover" | "contain" | "fill"The resize mode can be cover, contain or fill. Defaults to cover. Cover resizes the image to maintain it's aspect ratio while filling the entire width and height. Contain resizes the image to maintain it's aspect ratio while fitting the entire image within the width and height. Fill resizes the image to fill the entire width and height. If the object's aspect ratio does not match the width and height, the image will be stretched to fit.
widthOptionalnumberThe width of the image in pixels.
const { data, error } = await supabase
.storage
.from('avatars')
.createSignedUrl('folder/avatar1.png', 60)