Sign Up

FileSystemService

Constructors

Constructor

new FileSystemService(
   transport: HttpTransport,
   fileUrlSigner?: FileUrlSigner): FileSystemService;

Parameters:

  • transport HttpTransport
  • fileUrlSigner? FileUrlSigner

Returns:

  • FileSystemService

Methods

chmod()

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

Parameters:

  • path string
  • permissions FilePermissionsOptions

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:

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

Returns:

  • Promise<void>

find()

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

Parameters:

  • path string
  • pattern string

Returns:

  • Promise<ListResult<FileMatch>>

list()

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()

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

Parameters:

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

Returns:

  • Promise<void>

move()

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

Parameters:

  • source string
  • destination string

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:

  • path string
  • options PresignedUrlOptions = {}

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:

  • path string
  • options PresignedUrlOptions = {}

Returns:

  • Promise<string>

read()

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

Parameters:

  • path string
  • _options ReadFileOptions = {}

Returns:

  • Promise<Uint8Array>

readMany()

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

Parameters:

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

Returns:

  • Promise<BulkReadResult>

readText()

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

Parameters:

  • path string
  • options ReadFileOptions = {}

Returns:

  • Promise<string>

replace()

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

Parameters:

  • files string[]
  • pattern string
  • newValue string

Returns:

  • Promise<ListResult<ReplaceResult>>

rm()

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()

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

Parameters:

  • path string

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:

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

Returns:

  • Promise<void>

watchDir()

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()

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

Parameters:

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

Returns:

  • Promise<void>

writeMany()

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

Parameters:

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

Returns:

  • Promise<BulkWriteResult>

writeText()

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

Parameters:

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

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? TransferProgressCallback
  • signal? AbortSignal

FilePermissionsParams

type FilePermissionsParams = FilePermissionsOptions

FilesystemEvent

Properties:

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

Match

type Match = OptionalizeNullable<Schema<"Match">>

PresignedUrlOptions

Properties:

  • expiresInSeconds? number

ReadFileOptions


ReadManyOptions


SearchFilesResponse

type SearchFilesResponse = ListResult<string>

TransferProgressCallback


UploadFileOptions

Properties:

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

WatchDirOptions

Properties:

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

WatchHandle

Properties:

  • exitError Error | undefined

Methods

stop()

stop(): Promise<void>;

Returns:

  • Promise<void>

waitForExit()

waitForExit(): Promise<Error | undefined>;

Returns:

  • Promise<Error | undefined>

WriteFileOptions

Properties:

  • mode? string
  • atomic? 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:

  • items T[]
  • nextCursor? string
  • total number
  • totalRelation string
  • partialRegions string[]

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? string
  • imageRefPrefix? string
  • labels? Record<string, string> - Containment: every listed label must match.
  • persistent? boolean
  • spot? boolean
  • forkedFrom? string - Sandboxes forked from this sandbox id.
  • minVcpus? number
  • maxVcpus? number
  • minMemMib? number
  • maxMemMib? number
  • minScratchMib? number
  • maxScratchMib? number
  • createdAfter? SearchTimestamp
  • createdBefore? SearchTimestamp
  • updatedAfter? SearchTimestamp
  • updatedBefore? SearchTimestamp
  • lastActiveAfter? SearchTimestamp
  • lastActiveBefore? 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.

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 | string

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


FileInfo

type FileInfo = OptionalizeNullable<Schema<"FileInfo">>

FileMatch

type FileMatch = toolbox.Match

ReplaceResult

type ReplaceResult = OptionalizeNullable<Schema<"ReplaceResult">>

FilePermissionsOptions

Properties:

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

BulkWriteFile

Properties:

  • path string
  • bytes number

BulkWriteResult

Properties:

  • files BulkWriteFile[]
  • errors string[]

BulkReadError

Properties:

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

BulkReadResult

Properties:

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

SIGNED_FILE_MAX_TTL_SECONDS

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.