FileSystemService
Constructors
Constructor
new FileSystemService(
transport: HttpTransport,
fileUrlSigner?: FileUrlSigner): FileSystemService;Parameters:
transportHttpTransportfileUrlSigner?FileUrlSigner
Returns:
FileSystemService
Methods
chmod()
chmod(path: string, permissions: FilePermissionsOptions): Promise<void>;Parameters:
pathstringpermissionsFilePermissionsOptions
Returns:
Promise<void>
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()
find(path: string, pattern: string): Promise<ListResult<FileMatch>>;Parameters:
pathstringpatternstring
Returns:
Promise<ListResult<FileMatch>>
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()
mkdir(path: string, options: { mode?: string } = {}): Promise<void>;Parameters:
pathstringoptions{ mode?: string } = {}
Returns:
Promise<void>
move()
move(source: string, destination: string): Promise<void>;Parameters:
sourcestringdestinationstring
Returns:
Promise<void>
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()
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()
read(path: string, _options: ReadFileOptions = {}): Promise<Uint8Array>;Parameters:
pathstring_optionsReadFileOptions = {}
Returns:
Promise<Uint8Array>
readMany()
readMany(
paths: readonly string[],
_options: ReadManyOptions = {}): Promise<BulkReadResult>;Parameters:
pathsreadonly string[]_optionsReadManyOptions = {}
Returns:
Promise<BulkReadResult>
readText()
readText(path: string, options: ReadFileOptions = {}): Promise<string>;Parameters:
pathstringoptionsReadFileOptions = {}
Returns:
Promise<string>
replace()
replace(
files: string[],
pattern: string,
newValue: string): Promise<ListResult<ReplaceResult>>;Parameters:
filesstring[]patternstringnewValuestring
Returns:
Promise<ListResult<ReplaceResult>>
rm()
rm(path: string, options: { recursive?: boolean } = {}): Promise<void>;Parameters:
pathstringoptions{ recursive?: boolean } = {}
Returns:
Promise<void>
search()
search(path: string, pattern: string): Promise<ListResult<string>>;Parameters:
pathstringpatternstring
Returns:
Promise<ListResult<string>>
stat()
stat(path: string): Promise<FileInfo>;Parameters:
pathstring
Returns:
Promise<FileInfo>
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()
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()
write(
path: string,
data: string | Uint8Array,
options: WriteFileOptions = {}): Promise<void>;Parameters:
pathstringdatastring | Uint8ArrayoptionsWriteFileOptions = {}
Returns:
Promise<void>
writeMany()
writeMany(
files: Record<string, Uint8Array>,
options: WriteManyOptions = {}): Promise<BulkWriteResult>;Parameters:
filesRecord<string, Uint8Array>optionsWriteManyOptions = {}
Returns:
Promise<BulkWriteResult>
writeText()
writeText(path: string, text: string, options: WriteFileOptions = {}): Promise<void>;Parameters:
pathstringtextstringoptionsWriteFileOptions = {}
Returns:
Promise<void>
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
Properties:
onProgress?TransferProgressCallbacksignal?AbortSignal
FilePermissionsParams
type FilePermissionsParams = FilePermissionsOptionsFilesystemEvent
Properties:
typeFilesystemEventTypenamestringisDirbooleantimestampnumber
Match
type Match = OptionalizeNullable<Schema<"Match">>PresignedUrlOptions
Properties:
expiresInSeconds?number
ReadFileOptions
ReadManyOptions
SearchFilesResponse
type SearchFilesResponse = ListResult<string>TransferProgressCallback
UploadFileOptions
Properties:
onProgress?TransferProgressCallbacksignal?AbortSignalatomic?boolean
WatchDirOptions
Properties:
recursive?booleanonExit?(err?: Error) => voidonOverflow?() => void
WatchHandle
Properties:
exitErrorError | undefined
Methods
stop()
stop(): Promise<void>;Returns:
Promise<void>
waitForExit()
waitForExit(): Promise<Error | undefined>;Returns:
Promise<Error | undefined>
WriteFileOptions
Properties:
mode?stringatomic?boolean
WriteManyOptions
Properties:
atomic?boolean
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). partialRegions names the
region slugs whose cell has not finished backfilling the index (or has never
heartbeated); results for them may be incomplete. Empty in steady state.
Properties:
itemsT[]nextCursor?stringtotalnumbertotalRelationstringpartialRegionsstring[]
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.persistent?booleanspot?booleanforkedFrom?string - Sandboxes forked from this sandbox id.minVcpus?numbermaxVcpus?numberminMemMib?numbermaxMemMib?numberminScratchMib?numbermaxScratchMib?numbercreatedAfter?SearchTimestampcreatedBefore?SearchTimestampupdatedAfter?SearchTimestampupdatedBefore?SearchTimestamplastActiveAfter?SearchTimestamplastActiveBefore?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
type SearchSort = 'created_at' | 'updated_at' | 'last_activity_at' | 'name' | 'vcpus' | 'mem_mib' | 'scratch_mib'SearchOrder
type SearchOrder = 'asc' | 'desc'SearchTimestamp
type SearchTimestamp = Date | stringAn RFC 3339 string, or a Date (serialized with toISOString(), i.e. UTC).
FileInfo
type FileInfo = OptionalizeNullable<Schema<"FileInfo">>FileMatch
type FileMatch = toolbox.MatchReplaceResult
type ReplaceResult = OptionalizeNullable<Schema<"ReplaceResult">>FilePermissionsOptions
Properties:
mode?stringowner?stringgroup?string
BulkWriteFile
Properties:
pathstringbytesnumber
BulkWriteResult
Properties:
filesBulkWriteFile[]errorsstring[]
BulkReadError
Properties:
pathstringcode?stringmessagestringsource?string
BulkReadResult
Properties:
filesRecord<string, Uint8Array>errorsBulkReadError[]
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.