supabase-rb-rb
Storage

List all files in a bucket

List objects under a prefix inside a bucket.

List objects under prefix inside the bucket. Pagination is offset/limit-based (the cursor-based list_v2 is a separate method exposed by Storage::FileApi#list_v2).

Signature

supabase.storage.from(bucket_id).list(prefix = nil,limit: nil,offset: nil,sort_by: nil,search: nil)

Parameters

NameTypeRequiredDescription
prefixStringOptionalFolder path to list under (e.g. "people/"). Positional. Defaults to "" (the bucket root) when omitted.
limitIntegerOptionalPage size. Defaults to 100 (DEFAULT_SEARCH_OPTIONS) when omitted.
offsetIntegerOptionalRow offset for pagination. Defaults to 0 when omitted.
sort_byHashOptionalSort spec, e.g. { column: "name", order: "asc" }. Defaults to { column: "name", order: "asc" }.
searchStringOptionalSubstring filter applied server-side to the object name within the prefix.

Returns

Returns
Array<Hash>

Raw response array from storage-api. Each entry carries "name", "id", "updated_at", "created_at", "last_accessed_at", and a "metadata" Hash (size, mimetype, etag, cacheControl, etc.). Folders appear as entries whose "id" is nil. Not wrapped in a Struct — index with string keys.

Example — list the bucket root

objects = supabase.storage.from("avatars").list
objects.first["name"]                # => "ada.png"
objects.first["metadata"]["size"]    # => 49213

Example — list under a prefix with paging

page = supabase.storage.from("avatars").list(
  "people/",
  limit: 50,
  offset: 0,
  sort_by: { column: "created_at", order: "desc" }
)

Example — search within a folder

matches = supabase.storage.from("avatars").list(
  "people/",
  search: "ada"
)

Wire payload: { "prefix": ..., "limit": 100, "offset": 0, "sortBy": { column, order }, "search": ... }. For cursor pagination, use list_v2(prefix:, limit:, cursor:, with_delimiter:, sort_by:).

On this page