content.list()

Fetches lightweight document entries from the handler's list route.

content.list(sources?)

Fetches lightweight document entries from the handler's list route.

Parameters:

  • sources?: a single source name, or an array of source names. Defaults to every source.

Returns: Promise<ContentListFile<Data>[]>

usage.ts
const all = await content.list()
const blog = await content.list('blog')

Like its server counterpart, the client list() is typed against the generated source registry. A known source name narrows each item's data to that source's type, an array of names gives the union, and anything else falls back to the registry-wide union:

typed.ts
const blog = await content.list('blog')
// blog[n].data: BlogData

const mixed = await content.list(['blog', 'docs'])
// mixed[n].data: BlogData | DocsData

Run type generation to populate the registry. Without it, data stays an open record, and you can always pass an explicit type argument (content.list<MyData>('blog')).