JavaScript: Download a file

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

Parameters

Examples

Download file

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

Download file with transformations

const \{ data, error \} = await supabase
  .storage
  .from('avatars')
  .download('folder/avatar1.png', \{
    transform: \{
      width: 100,
      height: 100,
      quality: 80
    \}
  \})