Javascript Reference v2.0

Download a file

Downloads a file from a private bucket. For public buckets, make a request to the URL returned from getPublicUrl instead.

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

    The full path and file name of the file to be downloaded. For example folder/image.png.

    options
    Optional
    object

const { data, error } = await supabase
  .storage
  .from('avatars')
  .download('folder/avatar1.png')