from.list()

Lists all the files within a bucket.

1const { data, error } = await supabase
2  .storage
3  .from('avatars')
4  .list('folder', {
5    limit: 100,
6    offset: 0,
7    sortBy: { column: 'name', order: 'asc' },
8  })

Parameters#

  • pathoptional
    string

    The folder path.

  • SearchOptionsrequired
    object

    No description provided.

      Properties
    • limitoptional
      number

      The number of files you want to be returned.

    • offsetoptional
      number

      The starting position.

    • searchoptional
      string

      The search string to filter files by.

    • sortByoptional
      SortBy

      The column to sort by. Can be any column inside a FileObject.

  • FetchParametersrequired
    object

    No description provided.

      Properties
    • signaloptional
      AbortSignal

      Pass in an AbortController's signal to cancel the request.

Notes#

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

Examples#

List files in a bucket#

1const { data, error } = await supabase
2  .storage
3  .from('avatars')
4  .list('folder', {
5    limit: 100,
6    offset: 0,
7    sortBy: { column: 'name', order: 'asc' },
8  })

Search files in a bucket#

1const { data, error } = await supabase
2  .storage
3  .from('avatars')
4  .list('folder', {
5    limit: 100,
6    offset: 0,
7    sortBy: { column: 'name', order: 'asc' },
8    search: 'jon'
9  })