FileSystemService
Section titled “FileSystemService”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new FileSystemService( transport: HttpTransport, fileUrlSigner?: FileUrlSigner): FileSystemService;Parameters:
transportHttpTransportfileUrlSigner?FileUrlSigner
Returns:
FileSystemService
Methods
Section titled “Methods”chmod()
Section titled “chmod()”chmod(path: string, permissions: FilePermissionsOptions): Promise<void>;Parameters:
pathstringpermissionsFilePermissionsOptions
Returns:
Promise<void>
downloadFile()
Section titled “downloadFile()”downloadFile( remotePath: string, localPath: string, options: DownloadFileOptions = {}): Promise<void>;Stream a sandbox file to disk via an exclusive random temp file in the destination directory, renaming on success. Progress callback errors are swallowed. Node.js only.
Parameters:
remotePathstringlocalPathstringoptionsDownloadFileOptions = {}
Returns:
Promise<void>
find()
Section titled “find()”find(path: string, pattern: string): Promise<ListResult<FileMatch>>;Parameters:
pathstringpatternstring
Returns:
Promise<ListResult<FileMatch>>
list()
Section titled “list()”list(path: string, options: { depth?: number } = {}): Promise<ListResult<FileInfo>>;List a directory; response always has {items,nextCursor}.
Parameters:
pathstringoptions{ depth?: number } = {}
Returns:
Promise<ListResult<FileInfo>>
mkdir()
Section titled “mkdir()”mkdir(path: string, options: { mode?: string } = {}): Promise<void>;Parameters:
pathstringoptions{ mode?: string } = {}
Returns:
Promise<void>
move()
Section titled “move()”move(source: string, destination: string): Promise<void>;Parameters:
sourcestringdestinationstring
Returns:
Promise<void>
presignedDownloadUrl()
Section titled “presignedDownloadUrl()”presignedDownloadUrl(path: string, options: PresignedUrlOptions = {}): Promise<string>;Pre-signed download URL for a sandbox file. The signature is minted by the
control plane; expiresInSeconds must be between 1 and
SIGNED_FILE_MAX_TTL_SECONDS (7 days).
Parameters:
pathstringoptionsPresignedUrlOptions = {}
Returns:
Promise<string>
presignedUploadUrl()
Section titled “presignedUploadUrl()”presignedUploadUrl(path: string, options: PresignedUrlOptions = {}): Promise<string>;Pre-signed upload URL for a sandbox file. The signature is minted by the
control plane; expiresInSeconds must be between 1 and
SIGNED_FILE_MAX_TTL_SECONDS (7 days).
Parameters:
pathstringoptionsPresignedUrlOptions = {}
Returns:
Promise<string>
read()
Section titled “read()”read(path: string, _options: ReadFileOptions = {}): Promise<Uint8Array>;Parameters:
pathstring_optionsReadFileOptions = {}
Returns:
Promise<Uint8Array>
readMany()
Section titled “readMany()”readMany( paths: readonly string[], _options: ReadManyOptions = {}): Promise<BulkReadResult>;Parameters:
pathsreadonly string[]_optionsReadManyOptions = {}
Returns:
Promise<BulkReadResult>
readText()
Section titled “readText()”readText(path: string, options: ReadFileOptions = {}): Promise<string>;Parameters:
pathstringoptionsReadFileOptions = {}
Returns:
Promise<string>
replace()
Section titled “replace()”replace( files: string[], pattern: string, newValue: string): Promise<ListResult<ReplaceResult>>;Parameters:
filesstring[]patternstringnewValuestring
Returns:
Promise<ListResult<ReplaceResult>>
rm(path: string, options: { recursive?: boolean } = {}): Promise<void>;Parameters:
pathstringoptions{ recursive?: boolean } = {}
Returns:
Promise<void>
search()
Section titled “search()”search(path: string, pattern: string): Promise<ListResult<string>>;Parameters:
pathstringpatternstring
Returns:
Promise<ListResult<string>>
stat()
Section titled “stat()”stat(path: string): Promise<FileInfo>;Parameters:
pathstring
Returns:
Promise<FileInfo>
uploadFile()
Section titled “uploadFile()”uploadFile( localPath: string, remotePath: string, options: UploadFileOptions = {}): Promise<void>;Stream a local file to the sandbox without buffering the full body in memory. Progress callback errors are swallowed. Node.js only.
Parameters:
localPathstringremotePathstringoptionsUploadFileOptions = {}
Returns:
Promise<void>
watchDir()
Section titled “watchDir()”watchDir( path: string, onEvent: (event: FilesystemEvent) => void | Promise<void>, options: WatchDirOptions = {}): Promise<WatchHandle>;Parameters:
pathstringonEvent(event: FilesystemEvent) = > void | Promise<void>, options: WatchDirOptions = {}
Returns:
Promise<WatchHandle>
write()
Section titled “write()”write( path: string, data: string | Uint8Array, options: WriteFileOptions = {}): Promise<void>;Parameters:
pathstringdatastring | Uint8ArrayoptionsWriteFileOptions = {}
Returns:
Promise<void>
writeMany()
Section titled “writeMany()”writeMany( files: Record<string, Uint8Array>, options: WriteManyOptions = {}): Promise<BulkWriteResult>;Parameters:
filesRecord<string, Uint8Array>optionsWriteManyOptions = {}
Returns:
Promise<BulkWriteResult>
writeText()
Section titled “writeText()”writeText(path: string, text: string, options: WriteFileOptions = {}): Promise<void>;Parameters:
pathstringtextstringoptionsWriteFileOptions = {}
Returns:
Promise<void>
FilesystemEventType
Section titled “FilesystemEventType”enum FilesystemEventType { CREATE = 'create', WRITE = 'write', REMOVE = 'remove', RENAME = 'rename', CHMOD = 'chmod',}Properties:
CREATE‘create’WRITE‘write’REMOVE‘remove’RENAME‘rename’CHMOD‘chmod’
DownloadFileOptions
Section titled “DownloadFileOptions”Properties:
onProgress?TransferProgressCallbacksignal?AbortSignal
FilePermissionsParams
Section titled “FilePermissionsParams”type FilePermissionsParams = FilePermissionsOptionsFilesystemEvent
Section titled “FilesystemEvent”Properties:
typeFilesystemEventTypenamestringisDirbooleantimestampnumber
type Match = FileMatchPresignedUrlOptions
Section titled “PresignedUrlOptions”Properties:
expiresInSeconds?number
ReadFileOptions
Section titled “ReadFileOptions”ReadManyOptions
Section titled “ReadManyOptions”SearchFilesResponse
Section titled “SearchFilesResponse”type SearchFilesResponse = ListResult<string>TransferProgressCallback
Section titled “TransferProgressCallback”UploadFileOptions
Section titled “UploadFileOptions”Properties:
onProgress?TransferProgressCallbacksignal?AbortSignalatomic?boolean
WatchDirOptions
Section titled “WatchDirOptions”Properties:
recursive?booleanonExit?(err?: Error) => voidonOverflow?() => void
WatchHandle
Section titled “WatchHandle”Properties:
exitErrorError | undefined
Methods
Section titled “Methods”stop()
Section titled “stop()”stop(): Promise<void>;Returns:
Promise<void>
waitForExit()
Section titled “waitForExit()”waitForExit(): Promise<Error | undefined>;Returns:
Promise<Error | undefined>
WriteFileOptions
Section titled “WriteFileOptions”Properties:
mode?stringatomic?boolean
WriteManyOptions
Section titled “WriteManyOptions”Properties:
atomic?boolean
SearchResult
Section titled “SearchResult”One page of GET /sandboxes/search (Daytona.search()).
total is exact when totalRelation === 'eq' and a lower bound when it is
'gte' (the index caps exact counting at 10 000).
Properties:
itemsT[]nextCursor?stringtotalnumbertotalRelationSearchTotalRelationrawTotalRelationstring
SearchSandboxesOptions
Section titled “SearchSandboxesOptions”Every Daytona.search() option (GET /sandboxes/search).
Properties:
q?string - Free text over name and image; also an exact match when it is a sandbox id.status?string | readonly string[] - A single value or a list (any-of) over the API’s lifecycle state names (running,stopped, …).vmClass?VmClass | readonly VmClass[] - A single value or a list (any-of).region?string | readonly string[] - A single value or a list (any-of) over region slugs.imageRef?stringimageRefPrefix?stringlabels?Record<string, string> - Containment: every listed label must match.spot?booleanforkedFrom?string - Sandboxes forked from this sandbox id.minVcpus?numbermaxVcpus?numberminMemoryMib?numbermaxMemoryMib?numberminDiskMib?numbermaxDiskMib?numbercreatedStartAt?SearchTimestampcreatedEndAt?SearchTimestampupdatedStartAt?SearchTimestampupdatedEndAt?SearchTimestamplastActivityStartAt?SearchTimestamplastActivityEndAt?SearchTimestampsort?SearchSort - Defaults tocreated_at.order?SearchOrder - Defaults todesc.namePrefix?string - Server-side prefix on the name (the search form oflist({ name })).idPrefix?string - Server-side prefix on the id (the search form oflist({ id })).limit?number - Clamped to 1..200 by the server.cursor?string - Opaque; bound to the filter + sort that produced it.
SearchSort
Section titled “SearchSort”type SearchSort = 'created_at' | 'updated_at' | 'last_activity_at' | 'name' | 'vcpus' | 'memory_mib' | 'disk_mib'SearchOrder
Section titled “SearchOrder”type SearchOrder = 'asc' | 'desc'SearchTimestamp
Section titled “SearchTimestamp”type SearchTimestamp = Date | stringAn RFC 3339 string, or a Date (serialized with toISOString(), i.e. UTC).
SearchTotalRelation
Section titled “SearchTotalRelation”type SearchTotalRelation = (typeof API_SEARCH_TOTAL_RELATIONS)[number] | 'unknown'FileInfo
Section titled “FileInfo”Properties:
namestringpath?stringisDirbooleansizenumbermodTime?stringmodifiedAt?stringmode?stringpermissions?stringowner?stringgroup?string
FileMatch
Section titled “FileMatch”type FileMatch = toolbox.MatchReplaceResult
Section titled “ReplaceResult”Properties:
filestringsuccess?booleanerror?string
FilePermissionsOptions
Section titled “FilePermissionsOptions”Properties:
mode?stringowner?stringgroup?string
BulkWriteFile
Section titled “BulkWriteFile”Properties:
pathstringbytesnumber
BulkWriteResult
Section titled “BulkWriteResult”Properties:
filesBulkWriteFile[]errorsstring[]
BulkReadError
Section titled “BulkReadError”Properties:
pathstringcode?stringmessagestringsource?string
BulkReadResult
Section titled “BulkReadResult”Properties:
filesRecord<string, Uint8Array>errorsBulkReadError[]
SIGNED_FILE_MAX_TTL_SECONDS
Section titled “SIGNED_FILE_MAX_TTL_SECONDS”const SIGNED_FILE_MAX_TTL_SECONDS = 604_800Server ceiling on a pre-signed file URL’s lifetime (7 days). The API rejects
an expires further ahead than this, so the SDK refuses it before the
request; never-expiring links do not exist.