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
The file path, including the current file name. For example folder/image.png
.
The number of seconds until the signed URL expires. For example, 60
for a URL which is valid for one minute.
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.
Transform the asset before serving it to the client.
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.
The height of the image in pixels.
Set the quality of the returned image. A number from 20 to 100, with 100 being the highest quality. Defaults to 80
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.
The width of the image in pixels.
const { data, error } = await supabase
.storage
.from('avatars')
.createSignedUrl('folder/avatar1.png', 60)