FileSystemService
Section titled “FileSystemService”class FileSystemService()Sandbox filesystem namespace.
FileSystemService.__init__
Section titled “FileSystemService.__init__”def __init__(impl: AsyncFileSystemService, bridge: SyncBridge) -> NoneFileSystemService.chmod
Section titled “FileSystemService.chmod”def chmod(path: str, *, mode: Optional[str] = None, owner: Optional[str] = None, group: Optional[str] = None) -> NoneSet file permissions and ownership.
FileSystemService.delete
Section titled “FileSystemService.delete”def delete(path: str, *, recursive: bool = False) -> NoneDelete a file or directory.
FileSystemService.download_file
Section titled “FileSystemService.download_file”def download_file(remote_path: str, local_path: str | os.PathLike[str], *, on_progress: TransferProgressCallback | None = None, cancel: TransferCancelSignal | None = None) -> NoneFileSystemService.find
Section titled “FileSystemService.find”def find(path: str, pattern: str) -> ListResultFind files under a path.
FileSystemService.list
Section titled “FileSystemService.list”def list(path: str, *, depth: Optional[int] = None) -> ListResult[FileInfo]List directory entries as typed FileInfo rows (items, next_cursor).
FileSystemService.mkdir
Section titled “FileSystemService.mkdir”def mkdir(path: str, *, mode: str = '755') -> NoneCreate a directory.
FileSystemService.move
Section titled “FileSystemService.move”def move(source: str, destination: str) -> NoneMove or rename files.
FileSystemService.presigned_download_url
Section titled “FileSystemService.presigned_download_url”def presigned_download_url(path: str, *, expires_in_seconds: int = 3600) -> strReturn a pre-signed download URL for a sandbox file.
FileSystemService.presigned_upload_url
Section titled “FileSystemService.presigned_upload_url”def presigned_upload_url(path: str, *, expires_in_seconds: int = 3600) -> strReturn a pre-signed upload URL for a sandbox file.
FileSystemService.read_bytes
Section titled “FileSystemService.read_bytes”def read_bytes(path: str) -> bytesRead a file as bytes.
FileSystemService.read_many
Section titled “FileSystemService.read_many”def read_many(paths: Sequence[str]) -> BulkReadResultRead multiple files, buffering each returned file in memory before returning.
FileSystemService.read_text
Section titled “FileSystemService.read_text”def read_text(path: str) -> strRead a UTF-8 text file.
FileSystemService.replace
Section titled “FileSystemService.replace”def replace(files: Sequence[str], pattern: str, new_value: str) -> ListResultReplace text in files.
FileSystemService.search
Section titled “FileSystemService.search”def search(path: str, pattern: str) -> ListResult[str]Search file contents.
FileSystemService.stat
Section titled “FileSystemService.stat”def stat(path: str) -> FileInfoReturn file metadata.
FileSystemService.upload_file
Section titled “FileSystemService.upload_file”def upload_file(local_path: str | os.PathLike[str], remote_path: str, *, on_progress: TransferProgressCallback | None = None, cancel: TransferCancelSignal | None = None, atomic: bool = False) -> NoneStream a local file into the sandbox without buffering it whole in memory.
FileSystemService.watch_dir
Section titled “FileSystemService.watch_dir”def watch_dir(path: str, on_event: Optional[_WatchCallback] = None, *, recursive: bool = False, on_overflow: Optional[_OverflowCallback] = None, on_exit: Optional[_ExitCallback] = None) -> WatchHandleFileSystemService.write_bytes
Section titled “FileSystemService.write_bytes”def write_bytes(path: str, content: bytes, *, atomic: bool = False) -> NoneWrite bytes to a file, optionally via temp-file + rename.
FileSystemService.write_many
Section titled “FileSystemService.write_many”def write_many(files: Mapping[str, bytes], *, atomic: bool = False) -> BulkWriteResultWrite several files in one request, optionally atomically per file.
FileSystemService.write_text
Section titled “FileSystemService.write_text”def write_text(path: str, content: str, *, atomic: bool = False) -> NoneWrite a UTF-8 text file, optionally via temp-file + rename.
AsyncFileSystemService
Section titled “AsyncFileSystemService”class AsyncFileSystemService()Sandbox filesystem namespace.
AsyncFileSystemService.__init__
Section titled “AsyncFileSystemService.__init__”def __init__(transport: AsyncTransport, *, file_url_signer: Optional[FileUrlSigner] = None) -> NoneAsyncFileSystemService.read_bytes
Section titled “AsyncFileSystemService.read_bytes”async def read_bytes(path: str) -> bytesRead a file as bytes.
AsyncFileSystemService.read_text
Section titled “AsyncFileSystemService.read_text”async def read_text(path: str) -> strRead a UTF-8 text file.
AsyncFileSystemService.write_bytes
Section titled “AsyncFileSystemService.write_bytes”async def write_bytes(path: str, content: bytes, *, atomic: bool = False) -> NoneWrite bytes to a file, optionally via temp-file + rename.
AsyncFileSystemService.write_text
Section titled “AsyncFileSystemService.write_text”async def write_text(path: str, content: str, *, atomic: bool = False) -> NoneWrite a UTF-8 text file, optionally via temp-file + rename.
AsyncFileSystemService.presigned_download_url
Section titled “AsyncFileSystemService.presigned_download_url”async def presigned_download_url(path: str, *, expires_in_seconds: int = 3600) -> strReturn a pre-signed download URL for a sandbox file.
The signature is minted by the control plane; expires_in_seconds
must be between 1 and SIGNED_FILE_MAX_TTL_SECONDS (7 days).
AsyncFileSystemService.presigned_upload_url
Section titled “AsyncFileSystemService.presigned_upload_url”async def presigned_upload_url(path: str, *, expires_in_seconds: int = 3600) -> strReturn a pre-signed upload URL for a sandbox file.
The signature is minted by the control plane; expires_in_seconds
must be between 1 and SIGNED_FILE_MAX_TTL_SECONDS (7 days).
AsyncFileSystemService.write_many
Section titled “AsyncFileSystemService.write_many”async def write_many(files: Mapping[str, bytes], *, atomic: bool = False) -> BulkWriteResultWrite several files in one request, optionally atomically per file.
AsyncFileSystemService.upload_file
Section titled “AsyncFileSystemService.upload_file”async def upload_file(local_path: str | os.PathLike[str], remote_path: str, *, on_progress: TransferProgressCallback | None = None, cancel: TransferCancelSignal | None = None, atomic: bool = False) -> NoneStream a local file into the sandbox without buffering it whole in memory.
AsyncFileSystemService.download_file
Section titled “AsyncFileSystemService.download_file”async def download_file(remote_path: str, local_path: str | os.PathLike[str], *, on_progress: TransferProgressCallback | None = None, cancel: TransferCancelSignal | None = None) -> NoneAsyncFileSystemService.read_many
Section titled “AsyncFileSystemService.read_many”async def read_many(paths: Sequence[str]) -> BulkReadResultRead multiple files, buffering each returned file in memory before returning.
Non-200 responses raise the typed SDK error inside the transport; only a 200 multipart body reaches the parser.
AsyncFileSystemService.list
Section titled “AsyncFileSystemService.list”async def list(path: str, *, depth: Optional[int] = None) -> ListResult[FileInfo]List directory entries as typed FileInfo rows (items, next_cursor).
AsyncFileSystemService.stat
Section titled “AsyncFileSystemService.stat”async def stat(path: str) -> FileInfoReturn file metadata.
AsyncFileSystemService.mkdir
Section titled “AsyncFileSystemService.mkdir”async def mkdir(path: str, *, mode: str = '755') -> NoneCreate a directory.
AsyncFileSystemService.delete
Section titled “AsyncFileSystemService.delete”async def delete(path: str, *, recursive: bool = False) -> NoneDelete a file or directory.
AsyncFileSystemService.move
Section titled “AsyncFileSystemService.move”async def move(source: str, destination: str) -> NoneMove or rename files.
AsyncFileSystemService.find
Section titled “AsyncFileSystemService.find”async def find(path: str, pattern: str) -> ListResultFind files under a path.
AsyncFileSystemService.search
Section titled “AsyncFileSystemService.search”async def search(path: str, pattern: str) -> ListResult[str]Search file contents.
AsyncFileSystemService.replace
Section titled “AsyncFileSystemService.replace”async def replace(files: Sequence[str], pattern: str, new_value: str) -> ListResultReplace text in files.
AsyncFileSystemService.chmod
Section titled “AsyncFileSystemService.chmod”async def chmod(path: str, *, mode: Optional[str] = None, owner: Optional[str] = None, group: Optional[str] = None) -> NoneSet file permissions and ownership.
AsyncFileSystemService.watch_dir
Section titled “AsyncFileSystemService.watch_dir”async def watch_dir(path: str, on_event: Optional[_WatchCallback] = None, *, recursive: bool = False, on_overflow: Optional[_OverflowCallback] = None, on_exit: Optional[_ExitCallback] = None) -> AsyncWatchHandleWatchHandle
Section titled “WatchHandle”class WatchHandle()A running directory watch.
WatchHandle.__init__
Section titled “WatchHandle.__init__”def __init__(impl: AsyncWatchHandle, bridge: SyncBridge) -> NoneWatchHandle.attach_reader
Section titled “WatchHandle.attach_reader”def attach_reader(reader: asyncio.Task[None]) -> NoneWatchHandle.get_new_events
Section titled “WatchHandle.get_new_events”def get_new_events() -> list[FilesystemEvent]WatchHandle.record_callback_error
Section titled “WatchHandle.record_callback_error”def record_callback_error(error: Exception) -> NoneWatchHandle.record_exit
Section titled “WatchHandle.record_exit”def record_exit(error: Exception | None) -> NoneWatchHandle.record_overflow
Section titled “WatchHandle.record_overflow”def record_overflow() -> NoneWatchHandle.stop
Section titled “WatchHandle.stop”def stop() -> NoneWatchHandle.wait_for_exit
Section titled “WatchHandle.wait_for_exit”def wait_for_exit() -> Exception | NoneWatchHandle.exit_error
Section titled “WatchHandle.exit_error”@propertydef exit_error() -> Exception | NoneWatchHandle.last_callback_error
Section titled “WatchHandle.last_callback_error”@propertydef last_callback_error() -> Exception | NoneWatchHandle.overflow_count
Section titled “WatchHandle.overflow_count”@propertydef overflow_count() -> intAsyncWatchHandle
Section titled “AsyncWatchHandle”class AsyncWatchHandle()A running directory watch.
Single-task, single-loop: the reader is one asyncio.Task and every
method runs on the same loop, so the sync version’s five locks collapse to
plain attributes. Only the exit event survives, because wait_for_exit
genuinely waits.
AsyncWatchHandle.__init__
Section titled “AsyncWatchHandle.__init__”def __init__(stream: _LineStream, events: asyncio.Queue[FilesystemEvent], on_exit: Optional[_ExitCallback] = None) -> NoneAsyncWatchHandle.overflow_count
Section titled “AsyncWatchHandle.overflow_count”@propertydef overflow_count() -> intAsyncWatchHandle.attach_reader
Section titled “AsyncWatchHandle.attach_reader”def attach_reader(reader: asyncio.Task[None]) -> NoneAsyncWatchHandle.exit_error
Section titled “AsyncWatchHandle.exit_error”@propertydef exit_error() -> Exception | NoneAsyncWatchHandle.last_callback_error
Section titled “AsyncWatchHandle.last_callback_error”@propertydef last_callback_error() -> Exception | NoneAsyncWatchHandle.record_callback_error
Section titled “AsyncWatchHandle.record_callback_error”def record_callback_error(error: Exception) -> NoneAsyncWatchHandle.record_exit
Section titled “AsyncWatchHandle.record_exit”async def record_exit(error: Exception | None) -> NoneAsyncWatchHandle.record_overflow
Section titled “AsyncWatchHandle.record_overflow”def record_overflow() -> NoneAsyncWatchHandle.wait_for_exit
Section titled “AsyncWatchHandle.wait_for_exit”async def wait_for_exit() -> Exception | NoneAsyncWatchHandle.get_new_events
Section titled “AsyncWatchHandle.get_new_events”def get_new_events() -> list[FilesystemEvent]AsyncWatchHandle.stop
Section titled “AsyncWatchHandle.stop”async def stop() -> NoneFileInfo
Section titled “FileInfo”class FileInfo(BaseModel)One filesystem entry as /files and /files/info serialize it.
Attributes:
groupStrictStr = Field(description=‘Numeric group id rendered as a string.’)is_dirStrictBool = Field(description=‘Whether the entry is a directory.’, alias=‘isDir’)mod_timeStrictStr = Field(description=‘Deprecated but load-bearing: Gotime.String()layout for the last modification time.’, alias=‘modTime’)modeStrictStr = Field(description=‘Goos.FileMode.String()layout (-rw-r--r--,drwxr-xr-x, …).’)modified_atStrictStr = Field(description=‘RFC 3339 UTC timestamp for the last modification time.’, alias=‘modifiedAt’)nameStrictStr = Field(description=‘Base name of the entry.’)ownerStrictStr = Field(description=‘Numeric owner id rendered as a string.’)pathStrictStr = Field(description=“Absolute path to the entry, rendered in the guest’s path syntax.”)permissionsStrictStr = Field(description=‘Four-digit octal permissions (0644,0755, …).’)sizeAnnotated[int, Field(strict=True, ge=0)] = Field(description=‘Entry size in bytes.’)additional_propertiesDict[str, Any] = {}
model_config
Section titled “model_config”model_config = ConfigDict(populate_by_name=True, validate_assignment=True, protected_namespaces=())FileInfo.to_str
Section titled “FileInfo.to_str”def to_str() -> strReturns the string representation of the model using alias
FileInfo.to_json
Section titled “FileInfo.to_json”def to_json() -> strReturns the JSON representation of the model using alias
FileInfo.from_json
Section titled “FileInfo.from_json”@classmethoddef from_json(json_str: str) -> Optional[Self]Create an instance of FileInfo from a JSON string
FileInfo.to_dict
Section titled “FileInfo.to_dict”def to_dict() -> Dict[str, Any]Return the dictionary representation of the model using alias.
This has the following differences from calling pydantic’s
self.model_dump(by_alias=True):
Noneis only added to the output dict for nullable fields that were set at model initialization. Other fields with valueNoneare ignored.- Fields in
self.additional_propertiesare added to the output dict.
FileInfo.from_dict
Section titled “FileInfo.from_dict”@classmethoddef from_dict(obj: Optional[Dict[str, Any]]) -> Optional[Self]Create an instance of FileInfo from a dict
TransferCancelSignal
Section titled “TransferCancelSignal”class TransferCancelSignal(Protocol)A cancellation signal for file transfers.
asyncio.Event and threading.Event both satisfy this protocol.
TransferCancelSignal.is_set
Section titled “TransferCancelSignal.is_set”def is_set() -> boolFilesystemEventType
Section titled “FilesystemEventType”class FilesystemEventType(str, Enum)Attributes:
CREATE‘create’WRITE‘write’REMOVE‘remove’RENAME‘rename’CHMOD‘chmod’
SearchResult
Section titled “SearchResult”@dataclass(frozen=True)class SearchResult(Generic[T])One page of GET /sandboxes/search (Daytona.search()).
total is exact when total_relation == "eq" and a lower bound when it
is "gte" (the index caps exact counting at 10 000).
Attributes:
itemsList[T]next_cursorOptional[str] = Nonetotalint = 0total_relationSearchTotalRelation = ‘eq’raw_total_relationstr = ‘eq’
FilesystemEvent
Section titled “FilesystemEvent”@dataclass(frozen=True, slots=True)class FilesystemEvent()Attributes:
typeFilesystemEventTypenamestris_dirbooltimestampint
BulkWriteFile
Section titled “BulkWriteFile”@dataclass(frozen=True)class BulkWriteFile()Attributes:
pathstrbytesint
BulkWriteResult
Section titled “BulkWriteResult”@dataclass(frozen=True)class BulkWriteResult()Attributes:
filesList[BulkWriteFile]errorsList[str] = field(default_factory=list)
BulkReadError
Section titled “BulkReadError”@dataclass(frozen=True)class BulkReadError()Attributes:
pathstrmessagestrcodeOptional[str] = NonesourceOptional[str] = None
BulkReadResult
Section titled “BulkReadResult”@dataclass(frozen=True)class BulkReadResult()Attributes:
filesDict[str, bytes]errorsList[BulkReadError] = field(default_factory=list)
SearchSandboxesQuery
Section titled “SearchSandboxesQuery”@dataclass(frozen=True, kw_only=True)class SearchSandboxesQuery(SandboxSearchFilters)Every Daytona.search() parameter (GET /sandboxes/search); keyword-only.
Attributes:
name_prefixOptional[str] = Noneid_prefixOptional[str] = NonecursorOptional[str] = NonelimitOptional[int] = None
SIGNED_FILE_MAX_TTL_SECONDS
Section titled “SIGNED_FILE_MAX_TTL_SECONDS”SIGNED_FILE_MAX_TTL_SECONDS = 604800TransferProgressCallback
Section titled “TransferProgressCallback”TransferProgressCallback = Callable[[int, Optional[int]], None]SearchTotalRelation
Section titled “SearchTotalRelation”SearchTotalRelation = Literal['eq', 'gte', 'unknown']SearchSort
Section titled “SearchSort”SearchSort = Literal['created_at', 'updated_at', 'last_activity_at', 'name', 'vcpus', 'memory_mib', 'disk_mib']SearchOrder
Section titled “SearchOrder”SearchOrder = Literal['asc', 'desc']SearchTimestamp
Section titled “SearchTimestamp”SearchTimestamp = Union[str, datetime]An RFC 3339 string, or a datetime (naive values are taken as UTC).