Skip to main content
Read repository content without mounting the filesystem. Required scope: read
root = await mesa.content.get(repo="app", depth=1)
print(root.type)
print(root.is_dir())

readme = await mesa.content.get(repo="app", path="README.md")
if readme.is_file():
    print(readme.content)  # base64-encoded bytes

Options

repo
str
required
Repository name.
org
str | None
Organization override.
change_id
str | None
Change ID to read from. Defaults to the current change at the repository’s default bookmark tip.
path
str | None
Repository-relative path. Omit for the repository root.
depth
int | None
Directory traversal depth. 0 returns directory metadata only, 1 returns direct children, and the server maximum is 10.

Response

The method returns one generated model variant. The generated type_ field remains available, and type is exposed as a read-only alias.
is_file()
bool
Returns True when the response is a regular file.
is_dir()
bool
Returns True when the response is a directory.
Returns True when the response is a symlink.
type: 'file'
ContentFile
Regular file content.
Symbolic link content.
type: 'dir'
ContentDirectory
Directory listing.

ContentFile

type
'file'
Content variant discriminator.
name
str
Base name of the file.
path
str
Repository-relative path.
sha
str
Git object SHA.
is_conflicted
bool | None
Whether this path is conflicted when known.
size
int
Size in bytes.
encoding
'base64'
Encoding used for content.
content
str
Base64-encoded file bytes.
mode
'100644' | '100755'
POSIX file mode.
xattrs
dict[str, str] | None
Extended attributes for this path. Values are base64-encoded.
type
'symlink'
Content variant discriminator.
name
str
Base name of the symlink.
path
str
Repository-relative path.
sha
str
Git object SHA.
is_conflicted
bool | None
Whether this path is conflicted when known.
size
int
Size in bytes.
encoding
'base64'
Encoding used for content.
content
str
Base64-encoded symlink target bytes.
mode
'120000'
POSIX symlink mode.
xattrs
dict[str, str] | None
Extended attributes for this path. Values are base64-encoded.

ContentDirectory

type
'dir'
Content variant discriminator.
name
str
Base name of the directory.
path
str
Repository-relative path.
sha
str
Git object SHA.
child_count
int
Number of direct children in this directory.
entries
list[ContentDirectoryEntry]
Directory entries returned for the requested depth.
xattrs
dict[str, str] | None
Extended attributes attached to this directory. Values are base64-encoded.

ContentDirectoryEntry

type
'file' | 'symlink' | 'dir'
Entry variant discriminator.
name
str
Base name of the entry.
path
str
Repository-relative path.
sha
str
Git object SHA.
size
int | None
Size in bytes for file and symlink entries.
mode
'100644' | '100755' | '120000' | None
POSIX mode for file and symlink entries.