Skip to content
View as Markdown
new FileSystemService(
transport: HttpTransport,
fileUrlSigner?: FileUrlSigner): FileSystemService;

Parameters:

  • transport HttpTransport
  • fileUrlSigner? FileUrlSigner

Returns:

  • FileSystemService
chmod(path: string, permissions: FilePermissionsOptions): Promise<void>;

Parameters:

  • path string
  • permissions FilePermissionsOptions

Returns:

  • Promise<void>
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:

  • remotePath string
  • localPath string
  • options DownloadFileOptions = {}

Returns:

  • Promise<void>
find(path: string, pattern: string): Promise<ListResult<FileMatch>>;

Parameters:

  • path string
  • pattern string

Returns:

  • Promise<ListResult<FileMatch>>
list(path: string, options: { depth?: number } = {}): Promise<ListResult<FileInfo>>;

List a directory; response always has {items,nextCursor}.

Parameters:

  • path string
  • options { depth?: number } = {}

Returns:

  • Promise<ListResult<FileInfo>>
mkdir(path: string, options: { mode?: string } = {}): Promise<void>;

Parameters:

  • path string
  • options { mode?: string } = {}

Returns:

  • Promise<void>
move(source: string, destination: string): Promise<void>;

Parameters:

  • source string
  • destination string

Returns:

  • Promise<void>
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:

  • path string
  • options PresignedUrlOptions = {}

Returns:

  • Promise<string>
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:

  • path string
  • options PresignedUrlOptions = {}

Returns:

  • Promise<string>
read(path: string, _options: ReadFileOptions = {}): Promise<Uint8Array>;

Parameters:

  • path string
  • _options ReadFileOptions = {}

Returns:

  • Promise<Uint8Array>
readMany(
paths: readonly string[],
_options: ReadManyOptions = {}): Promise<BulkReadResult>;

Parameters:

  • paths readonly string[]
  • _options ReadManyOptions = {}

Returns:

  • Promise<BulkReadResult>
readText(path: string, options: ReadFileOptions = {}): Promise<string>;

Parameters:

  • path string
  • options ReadFileOptions = {}

Returns:

  • Promise<string>
replace(
files: string[],
pattern: string,
newValue: string): Promise<ListResult<ReplaceResult>>;

Parameters:

  • files string[]
  • pattern string
  • newValue string

Returns:

  • Promise<ListResult<ReplaceResult>>
rm(path: string, options: { recursive?: boolean } = {}): Promise<void>;

Parameters:

  • path string
  • options { recursive?: boolean } = {}

Returns:

  • Promise<void>
search(path: string, pattern: string): Promise<ListResult<string>>;

Parameters:

  • path string
  • pattern string

Returns:

  • Promise<ListResult<string>>
stat(path: string): Promise<FileInfo>;

Parameters:

  • path string

Returns:

  • Promise<FileInfo>
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:

  • localPath string
  • remotePath string
  • options UploadFileOptions = {}

Returns:

  • Promise<void>
watchDir(
path: string,
onEvent: (event: FilesystemEvent) => void | Promise<void>,
options: WatchDirOptions = {}): Promise<WatchHandle>;

Parameters:

  • path string
  • onEvent (event: FilesystemEvent) = > void | Promise<void>, options: WatchDirOptions = {}

Returns:

  • Promise<WatchHandle>
write(
path: string,
data: string | Uint8Array,
options: WriteFileOptions = {}): Promise<void>;

Parameters:

  • path string
  • data string | Uint8Array
  • options WriteFileOptions = {}

Returns:

  • Promise<void>
writeMany(
files: Record<string, Uint8Array>,
options: WriteManyOptions = {}): Promise<BulkWriteResult>;

Parameters:

  • files Record<string, Uint8Array>
  • options WriteManyOptions = {}

Returns:

  • Promise<BulkWriteResult>
writeText(path: string, text: string, options: WriteFileOptions = {}): Promise<void>;

Parameters:

  • path string
  • text string
  • options WriteFileOptions = {}

Returns:

  • Promise<void>

enum FilesystemEventType {
CREATE = 'create',
WRITE = 'write',
REMOVE = 'remove',
RENAME = 'rename',
CHMOD = 'chmod',
}

Properties:

  • CREATE ‘create’
  • WRITE ‘write’
  • REMOVE ‘remove’
  • RENAME ‘rename’
  • CHMOD ‘chmod’

Properties:

  • onProgress? TransferProgressCallback
  • signal? AbortSignal

type FilePermissionsParams = FilePermissionsOptions

Properties:

  • type FilesystemEventType
  • name string
  • isDir boolean
  • timestamp number

type Match = FileMatch

Properties:

  • expiresInSeconds? number



type SearchFilesResponse = ListResult<string>


Properties:

  • onProgress? TransferProgressCallback
  • signal? AbortSignal
  • atomic? boolean

Properties:

  • recursive? boolean
  • onExit? (err?: Error) => void
  • onOverflow? () => void

Properties:

  • exitError Error | undefined
stop(): Promise<void>;

Returns:

  • Promise<void>
waitForExit(): Promise<Error | undefined>;

Returns:

  • Promise<Error | undefined>

Properties:

  • mode? string
  • atomic? boolean

Properties:

  • atomic? boolean

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:

  • items T[]
  • nextCursor? string
  • total number
  • totalRelation SearchTotalRelation
  • rawTotalRelation string

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? string
  • imageRefPrefix? string
  • labels? Record<string, string> - Containment: every listed label must match.
  • spot? boolean
  • forkedFrom? string - Sandboxes forked from this sandbox id.
  • minVcpus? number
  • maxVcpus? number
  • minMemoryMib? number
  • maxMemoryMib? number
  • minDiskMib? number
  • maxDiskMib? number
  • createdStartAt? SearchTimestamp
  • createdEndAt? SearchTimestamp
  • updatedStartAt? SearchTimestamp
  • updatedEndAt? SearchTimestamp
  • lastActivityStartAt? SearchTimestamp
  • lastActivityEndAt? SearchTimestamp
  • sort? SearchSort - Defaults to created_at.
  • order? SearchOrder - Defaults to desc.
  • namePrefix? string - Server-side prefix on the name (the search form of list({ name })).
  • idPrefix? string - Server-side prefix on the id (the search form of list({ id })).
  • limit? number - Clamped to 1..200 by the server.
  • cursor? string - Opaque; bound to the filter + sort that produced it.

type SearchSort = 'created_at' | 'updated_at' | 'last_activity_at' | 'name' | 'vcpus' | 'memory_mib' | 'disk_mib'

type SearchOrder = 'asc' | 'desc'

type SearchTimestamp = Date | string

An RFC 3339 string, or a Date (serialized with toISOString(), i.e. UTC).


type SearchTotalRelation = (typeof API_SEARCH_TOTAL_RELATIONS)[number] | 'unknown'

Properties:

  • name string
  • path? string
  • isDir boolean
  • size number
  • modTime? string
  • modifiedAt? string
  • mode? string
  • permissions? string
  • owner? string
  • group? string

type FileMatch = toolbox.Match

Properties:

  • file string
  • success? boolean
  • error? string

Properties:

  • mode? string
  • owner? string
  • group? string

Properties:

  • path string
  • bytes number

Properties:

  • files BulkWriteFile[]
  • errors string[]

Properties:

  • path string
  • code? string
  • message string
  • source? string

Properties:

  • files Record<string, Uint8Array>
  • errors BulkReadError[]

const SIGNED_FILE_MAX_TTL_SECONDS = 604_800

Server 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.