from.createSignedUrl()

Creates a signed URL. Use a signed URL to share a file for a fixed amount of time.

1const { data, error } = await supabase
2  .storage
3  .from('avatars')
4  .createSignedUrl('folder/avatar1.png', 60)

Parameters#

  • pathrequired
    string

    The file path, including the current file name. For example folder/image.png.

  • expiresInrequired
    number

    The number of seconds until the signed URL expires. For example, 60 for a URL which is valid for one minute.

  • optionsoptional
    object

    No description provided.

      Properties
    • downloadrequired
      string
      |
      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.

        Properties
      • stringrequired
        object

        No description provided.

      • booleanrequired
        object

        No description provided.

Notes#

  • RLS policy permissions required:
    • buckets table permissions: none
    • objects table permissions: select
  • Refer to the Storage guide on how access control works

Examples#

Create Signed URL#

1const { data, error } = await supabase
2  .storage
3  .from('avatars')
4  .createSignedUrl('folder/avatar1.png', 60)