Lists all the files and folders within a path of the bucket.
Important: For folder entries, fields like id, updated_at, created_at, last_accessed_at, and metadata will be null. Only files have these fields populated. Additionally, deprecated fields like bucket_id, owner, and buckets are NOT returned by this method.
The folder path.
Search options including limit (defaults to 100), offset, sortBy, and search
Optional fetch parameters including signal for cancellation
const { data, error } = await supabase
.storage
.from('avatars')
.list('folder', {
limit: 100,
offset: 0,
sortBy: { column: 'name', order: 'asc' },
})
// Handle files vs folders
data?.forEach(item => {
if (item.id !== null) {
// It's a file
console.log('File:', item.name, 'Size:', item.metadata?.size)
} else {
// It's a folder
console.log('Folder:', item.name)
}
})
const { data, error } = await supabase
.storage
.from('avatars')
.list('folder', {
limit: 100,
offset: 0,
sortBy: { column: 'name', order: 'asc' },
search: 'jon'
})