@daytonaio/sdk 0.172.0 → 0.175.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (202) hide show
  1. package/LICENSE +190 -0
  2. package/{src → cjs}/CodeInterpreter.d.ts +1 -0
  3. package/cjs/CodeInterpreter.js.map +1 -0
  4. package/{src → cjs}/ComputerUse.d.ts +1 -0
  5. package/cjs/ComputerUse.js.map +1 -0
  6. package/{src → cjs}/Daytona.d.ts +1 -0
  7. package/{src → cjs}/Daytona.js +19 -17
  8. package/cjs/Daytona.js.map +1 -0
  9. package/{src → cjs}/FileSystem.d.ts +88 -5
  10. package/{src → cjs}/FileSystem.js +121 -35
  11. package/cjs/FileSystem.js.map +1 -0
  12. package/{src → cjs}/Git.d.ts +1 -0
  13. package/cjs/Git.js.map +1 -0
  14. package/{src → cjs}/Image.d.ts +1 -0
  15. package/cjs/Image.js.map +1 -0
  16. package/{src → cjs}/LspServer.d.ts +1 -0
  17. package/cjs/LspServer.js.map +1 -0
  18. package/{src → cjs}/ObjectStorage.d.ts +1 -0
  19. package/cjs/ObjectStorage.js.map +1 -0
  20. package/{src → cjs}/Process.d.ts +1 -0
  21. package/cjs/Process.js.map +1 -0
  22. package/{src → cjs}/PtyHandle.d.ts +1 -0
  23. package/cjs/PtyHandle.js.map +1 -0
  24. package/cjs/README.md +180 -0
  25. package/{src → cjs}/Sandbox.d.ts +1 -0
  26. package/cjs/Sandbox.js.map +1 -0
  27. package/{src → cjs}/Snapshot.d.ts +1 -0
  28. package/cjs/Snapshot.js.map +1 -0
  29. package/{src → cjs}/Volume.d.ts +1 -0
  30. package/cjs/Volume.js.map +1 -0
  31. package/{src → cjs}/errors/DaytonaError.d.ts +1 -0
  32. package/cjs/errors/DaytonaError.js.map +1 -0
  33. package/{src → cjs}/index.d.ts +2 -1
  34. package/cjs/index.js.map +1 -0
  35. package/cjs/package.json +3 -0
  36. package/{src → cjs}/types/Charts.d.ts +1 -0
  37. package/cjs/types/Charts.js.map +1 -0
  38. package/{src → cjs}/types/CodeInterpreter.d.ts +1 -0
  39. package/cjs/types/CodeInterpreter.js.map +1 -0
  40. package/{src → cjs}/types/ExecuteResponse.d.ts +1 -0
  41. package/cjs/types/ExecuteResponse.js.map +1 -0
  42. package/{src → cjs}/types/Pty.d.ts +1 -0
  43. package/cjs/types/Pty.js.map +1 -0
  44. package/{src → cjs}/utils/Binary.d.ts +1 -1
  45. package/{src → cjs}/utils/Binary.js +8 -2
  46. package/cjs/utils/Binary.js.map +1 -0
  47. package/cjs/utils/FileTransfer.d.ts +39 -0
  48. package/cjs/utils/FileTransfer.js +521 -0
  49. package/cjs/utils/FileTransfer.js.map +1 -0
  50. package/cjs/utils/Import.d.ts +40 -0
  51. package/cjs/utils/Import.js +155 -0
  52. package/cjs/utils/Import.js.map +1 -0
  53. package/{src → cjs}/utils/Multipart.d.ts +1 -0
  54. package/cjs/utils/Multipart.js.map +1 -0
  55. package/{src → cjs}/utils/Runtime.d.ts +1 -0
  56. package/cjs/utils/Runtime.js.map +1 -0
  57. package/{src → cjs}/utils/Stream.d.ts +1 -0
  58. package/cjs/utils/Stream.js.map +1 -0
  59. package/{src → cjs}/utils/WebSocket.d.ts +1 -0
  60. package/cjs/utils/WebSocket.js.map +1 -0
  61. package/{src → cjs}/utils/otel.decorator.d.ts +1 -0
  62. package/cjs/utils/otel.decorator.js.map +1 -0
  63. package/esm/CodeInterpreter.d.ts +95 -0
  64. package/esm/CodeInterpreter.js +292 -0
  65. package/esm/CodeInterpreter.js.map +1 -0
  66. package/esm/ComputerUse.d.ts +539 -0
  67. package/esm/ComputerUse.js +799 -0
  68. package/esm/ComputerUse.js.map +1 -0
  69. package/esm/Daytona.d.ts +357 -0
  70. package/esm/Daytona.js +530 -0
  71. package/esm/Daytona.js.map +1 -0
  72. package/esm/FileSystem.d.ts +453 -0
  73. package/esm/FileSystem.js +571 -0
  74. package/esm/FileSystem.js.map +1 -0
  75. package/esm/Git.d.ts +203 -0
  76. package/esm/Git.js +322 -0
  77. package/esm/Git.js.map +1 -0
  78. package/esm/Image.d.ts +265 -0
  79. package/esm/Image.js +581 -0
  80. package/esm/Image.js.map +1 -0
  81. package/esm/LspServer.d.ts +172 -0
  82. package/esm/LspServer.js +255 -0
  83. package/esm/LspServer.js.map +1 -0
  84. package/esm/ObjectStorage.d.ts +79 -0
  85. package/esm/ObjectStorage.js +195 -0
  86. package/esm/ObjectStorage.js.map +1 -0
  87. package/esm/Process.d.ts +490 -0
  88. package/esm/Process.js +642 -0
  89. package/esm/Process.js.map +1 -0
  90. package/esm/PtyHandle.d.ts +155 -0
  91. package/esm/PtyHandle.js +412 -0
  92. package/esm/PtyHandle.js.map +1 -0
  93. package/esm/README.md +180 -0
  94. package/esm/Sandbox.d.ts +476 -0
  95. package/esm/Sandbox.js +901 -0
  96. package/esm/Sandbox.js.map +1 -0
  97. package/esm/Snapshot.d.ts +140 -0
  98. package/esm/Snapshot.js +244 -0
  99. package/esm/Snapshot.js.map +1 -0
  100. package/esm/Volume.d.ts +84 -0
  101. package/esm/Volume.js +115 -0
  102. package/esm/Volume.js.map +1 -0
  103. package/esm/errors/DaytonaError.d.ts +171 -0
  104. package/esm/errors/DaytonaError.js +243 -0
  105. package/esm/errors/DaytonaError.js.map +1 -0
  106. package/esm/index.d.ts +22 -0
  107. package/esm/index.js +21 -0
  108. package/esm/index.js.map +1 -0
  109. package/esm/package.json +3 -0
  110. package/esm/types/Charts.d.ts +38 -0
  111. package/esm/types/Charts.js +33 -0
  112. package/esm/types/Charts.js.map +1 -0
  113. package/esm/types/CodeInterpreter.d.ts +77 -0
  114. package/esm/types/CodeInterpreter.js +6 -0
  115. package/esm/types/CodeInterpreter.js.map +1 -0
  116. package/esm/types/ExecuteResponse.d.ts +26 -0
  117. package/esm/types/ExecuteResponse.js +6 -0
  118. package/esm/types/ExecuteResponse.js.map +1 -0
  119. package/esm/types/Pty.d.ts +48 -0
  120. package/esm/types/Pty.js +6 -0
  121. package/esm/types/Pty.js.map +1 -0
  122. package/esm/utils/Binary.d.ts +38 -0
  123. package/esm/utils/Binary.js +163 -0
  124. package/esm/utils/Binary.js.map +1 -0
  125. package/esm/utils/FileTransfer.d.ts +39 -0
  126. package/esm/utils/FileTransfer.js +512 -0
  127. package/esm/utils/FileTransfer.js.map +1 -0
  128. package/esm/utils/Import.d.ts +40 -0
  129. package/esm/utils/Import.js +119 -0
  130. package/esm/utils/Import.js.map +1 -0
  131. package/esm/utils/Multipart.d.ts +29 -0
  132. package/esm/utils/Multipart.js +109 -0
  133. package/esm/utils/Multipart.js.map +1 -0
  134. package/esm/utils/Runtime.d.ts +44 -0
  135. package/esm/utils/Runtime.js +89 -0
  136. package/esm/utils/Runtime.js.map +1 -0
  137. package/esm/utils/Stream.d.ts +20 -0
  138. package/esm/utils/Stream.js +360 -0
  139. package/esm/utils/Stream.js.map +1 -0
  140. package/esm/utils/WebSocket.d.ts +10 -0
  141. package/esm/utils/WebSocket.js +22 -0
  142. package/esm/utils/WebSocket.js.map +1 -0
  143. package/esm/utils/otel.decorator.d.ts +83 -0
  144. package/esm/utils/otel.decorator.js +136 -0
  145. package/esm/utils/otel.decorator.js.map +1 -0
  146. package/package.json +55 -15
  147. package/src/CodeInterpreter.js.map +0 -1
  148. package/src/ComputerUse.js.map +0 -1
  149. package/src/Daytona.js.map +0 -1
  150. package/src/FileSystem.js.map +0 -1
  151. package/src/Git.js.map +0 -1
  152. package/src/Image.js.map +0 -1
  153. package/src/LspServer.js.map +0 -1
  154. package/src/ObjectStorage.js.map +0 -1
  155. package/src/Process.js.map +0 -1
  156. package/src/PtyHandle.js.map +0 -1
  157. package/src/Sandbox.js.map +0 -1
  158. package/src/Snapshot.js.map +0 -1
  159. package/src/Volume.js.map +0 -1
  160. package/src/__tests__/helpers.d.ts +0 -5
  161. package/src/__tests__/helpers.js +0 -26
  162. package/src/__tests__/helpers.js.map +0 -1
  163. package/src/errors/DaytonaError.js.map +0 -1
  164. package/src/index.js.map +0 -1
  165. package/src/types/Charts.js.map +0 -1
  166. package/src/types/CodeInterpreter.js.map +0 -1
  167. package/src/types/ExecuteResponse.js.map +0 -1
  168. package/src/types/Pty.js.map +0 -1
  169. package/src/utils/Binary.js.map +0 -1
  170. package/src/utils/FileTransfer.d.ts +0 -14
  171. package/src/utils/FileTransfer.js +0 -261
  172. package/src/utils/FileTransfer.js.map +0 -1
  173. package/src/utils/Import.d.ts +0 -97
  174. package/src/utils/Import.js +0 -79
  175. package/src/utils/Import.js.map +0 -1
  176. package/src/utils/Multipart.js.map +0 -1
  177. package/src/utils/Runtime.js.map +0 -1
  178. package/src/utils/Stream.js.map +0 -1
  179. package/src/utils/WebSocket.js.map +0 -1
  180. package/src/utils/otel.decorator.js.map +0 -1
  181. /package/{src → cjs}/CodeInterpreter.js +0 -0
  182. /package/{src → cjs}/ComputerUse.js +0 -0
  183. /package/{src → cjs}/Git.js +0 -0
  184. /package/{src → cjs}/Image.js +0 -0
  185. /package/{src → cjs}/LspServer.js +0 -0
  186. /package/{src → cjs}/ObjectStorage.js +0 -0
  187. /package/{src → cjs}/Process.js +0 -0
  188. /package/{src → cjs}/PtyHandle.js +0 -0
  189. /package/{src → cjs}/Sandbox.js +0 -0
  190. /package/{src → cjs}/Snapshot.js +0 -0
  191. /package/{src → cjs}/Volume.js +0 -0
  192. /package/{src → cjs}/errors/DaytonaError.js +0 -0
  193. /package/{src → cjs}/index.js +0 -0
  194. /package/{src → cjs}/types/Charts.js +0 -0
  195. /package/{src → cjs}/types/CodeInterpreter.js +0 -0
  196. /package/{src → cjs}/types/ExecuteResponse.js +0 -0
  197. /package/{src → cjs}/types/Pty.js +0 -0
  198. /package/{src → cjs}/utils/Multipart.js +0 -0
  199. /package/{src → cjs}/utils/Runtime.js +0 -0
  200. /package/{src → cjs}/utils/Stream.js +0 -0
  201. /package/{src → cjs}/utils/WebSocket.js +0 -0
  202. /package/{src → cjs}/utils/otel.decorator.js +0 -0
@@ -0,0 +1,453 @@
1
+ import { Configuration, FileInfo, Match, ReplaceResult, SearchFilesResponse } from '@daytona/toolbox-api-client';
2
+ import { FileSystemApi } from '@daytona/toolbox-api-client';
3
+ import type { Readable } from 'stream';
4
+ /**
5
+ * Parameters for setting file permissions in the Sandbox.
6
+ *
7
+ * @interface
8
+ * @property {string} [mode] - File mode/permissions in octal format (e.g. "644")
9
+ * @property {string} [owner] - User owner of the file
10
+ * @property {string} [group] - Group owner of the file
11
+ *
12
+ * @example
13
+ * const permissions: FilePermissionsParams = {
14
+ * mode: '644',
15
+ * owner: 'daytona',
16
+ * group: 'users'
17
+ * };
18
+ */
19
+ export type FilePermissionsParams = {
20
+ /** Group owner of the file */
21
+ group?: string;
22
+ /** File mode/permissions in octal format (e.g. "644") */
23
+ mode?: string;
24
+ /** User owner of the file */
25
+ owner?: string;
26
+ };
27
+ /**
28
+ * Represents a file to be uploaded to the Sandbox.
29
+ *
30
+ * @interface
31
+ * @property {string | Buffer} source - File to upload. If a Buffer, it is interpreted as the file content which is loaded into memory.
32
+ * Make sure it fits into memory, otherwise use the local file path which content will be streamed to the Sandbox.
33
+ * @property {string} destination - Absolute destination path in the Sandbox. Relative paths are resolved based on the sandbox working directory.
34
+ */
35
+ export interface FileUpload {
36
+ source: string | Buffer;
37
+ destination: string;
38
+ }
39
+ /**
40
+ * Represents a request to download a single file from the Sandbox.
41
+ *
42
+ * @interface
43
+ * @property {string} source - Source path in the Sandbox. Relative paths are resolved based on the user's
44
+ * root directory.
45
+ * @property {string} [destination] - Destination path in the local filesystem where the file content will be
46
+ * streamed to. If not provided, the file will be downloaded in the bytes buffer (might cause memory issues if the file is large).
47
+ */
48
+ export interface FileDownloadRequest {
49
+ source: string;
50
+ destination?: string;
51
+ }
52
+ /**
53
+ * Structured error metadata for a failed bulk file download item.
54
+ *
55
+ * @interface
56
+ * @property {string} message - Human-readable error message.
57
+ * @property {number | undefined} [statusCode] - HTTP-style status code for the per-file failure.
58
+ * @property {string | undefined} [errorCode] - Machine-readable error code for the per-file failure.
59
+ */
60
+ export interface FileDownloadErrorDetails {
61
+ message: string;
62
+ statusCode?: number;
63
+ errorCode?: string;
64
+ }
65
+ /**
66
+ * Represents the response to a single file download request.
67
+ *
68
+ * @interface
69
+ * @property {string} source - The original source path requested for download.
70
+ * @property {Buffer | string | undefined} [result] - The download result - file path (if destination provided in the request)
71
+ * or bytes content (if no destination in the request), undefined if failed or no data received.
72
+ * @property {string | undefined} [error] - Error message if the download failed, undefined if successful.
73
+ * @property {FileDownloadErrorDetails | undefined} [errorDetails] - Structured error metadata when the server provides it.
74
+ */
75
+ export interface FileDownloadResponse {
76
+ source: string;
77
+ result?: Buffer | string;
78
+ error?: string;
79
+ errorDetails?: FileDownloadErrorDetails;
80
+ }
81
+ /**
82
+ * Represents metadata for a file download operation.
83
+ *
84
+ * @interface
85
+ * @property {string | undefined} [destination] - Destination path in the local filesystem where the file content will be streamed to.
86
+ * @property {string | undefined} [error] - Error message if the download failed, undefined if successful.
87
+ * @property {FileDownloadErrorDetails | undefined} [errorDetails] - Structured error metadata for a failed download item.
88
+ * @property {Buffer | string | Uint8Array | undefined} [result] - The download result - file path (if destination provided in the request)
89
+ * or bytes content (if no destination in the request), undefined if failed or no data received.
90
+ */
91
+ export interface DownloadMetadata {
92
+ destination?: string;
93
+ error?: string;
94
+ errorDetails?: FileDownloadErrorDetails;
95
+ result?: Buffer | string | Uint8Array;
96
+ }
97
+ export type DownloadProgress = {
98
+ /** Cumulative bytes received so far. */
99
+ bytesReceived: number;
100
+ /** Total bytes expected, if known. Undefined if unavailable. */
101
+ totalBytes?: number;
102
+ };
103
+ export type UploadProgress = {
104
+ /** Cumulative bytes sent so far. */
105
+ bytesSent: number;
106
+ };
107
+ /**
108
+ * Options for streaming file downloads.
109
+ *
110
+ * @interface
111
+ * @property {number} [timeout] - Timeout in seconds. 0 means no timeout. Default is 30 minutes.
112
+ * @property {AbortSignal} [signal] - AbortSignal for cancelling the download.
113
+ * @property {(progress: DownloadProgress) => void} [onProgress] - Callback invoked with cumulative progress information.
114
+ */
115
+ export type DownloadStreamOptions = {
116
+ /** Callback invoked with cumulative progress information as the download progresses. */
117
+ onProgress?: (progress: DownloadProgress) => void;
118
+ /** AbortSignal for cancelling the download. */
119
+ signal?: AbortSignal;
120
+ /** Timeout in seconds. 0 means no timeout. Default is 30 minutes. */
121
+ timeout?: number;
122
+ };
123
+ /**
124
+ * Source for a streaming file upload. The same input shapes accepted by
125
+ * {@link FileSystem.uploadFile} are also valid here, plus Node `Readable`
126
+ * streams and Web `ReadableStream` instances.
127
+ */
128
+ export type UploadSource = Buffer | Uint8Array | string | Readable | ReadableStream<Uint8Array>;
129
+ /**
130
+ * Options for streaming file uploads.
131
+ *
132
+ * @interface
133
+ * @property {number} [timeout] - Timeout in seconds. 0 means no timeout. Default is 30 minutes.
134
+ * @property {AbortSignal} [signal] - AbortSignal for cancelling the upload.
135
+ * @property {(progress: UploadProgress) => void} [onProgress] - Callback invoked with cumulative progress information.
136
+ */
137
+ export type UploadStreamOptions = {
138
+ /** Callback invoked with cumulative progress information as the upload progresses. */
139
+ onProgress?: (progress: UploadProgress) => void;
140
+ /** AbortSignal for cancelling the upload. */
141
+ signal?: AbortSignal;
142
+ /** Timeout in seconds. 0 means no timeout. Default is 30 minutes. */
143
+ timeout?: number;
144
+ };
145
+ /**
146
+ * Provides file system operations within a Sandbox.
147
+ *
148
+ * @class
149
+ */
150
+ export declare class FileSystem {
151
+ private readonly clientConfig;
152
+ private readonly apiClient;
153
+ constructor(clientConfig: Configuration, apiClient: FileSystemApi);
154
+ /**
155
+ * Create a new directory in the Sandbox with specified permissions.
156
+ *
157
+ * @param {string} path - Path where the directory should be created. Relative paths are resolved based on the sandbox working directory.
158
+ * @param {string} mode - Directory permissions in octal format (e.g. "755")
159
+ * @returns {Promise<void>}
160
+ *
161
+ * @example
162
+ * // Create a directory with standard permissions
163
+ * await fs.createFolder('app/data', '755');
164
+ */
165
+ createFolder(path: string, mode: string): Promise<void>;
166
+ /**
167
+ * Deletes a file or directory from the Sandbox.
168
+ *
169
+ * @param {string} path - Path to the file or directory to delete. Relative paths are resolved based on the sandbox working directory.
170
+ * @param {boolean} [recursive] - If the file is a directory, this must be true to delete it.
171
+ * @returns {Promise<void>}
172
+ *
173
+ * @example
174
+ * // Delete a file
175
+ * await fs.deleteFile('app/temp.log');
176
+ */
177
+ deleteFile(path: string, recursive?: boolean): Promise<void>;
178
+ /**
179
+ * Downloads a file from the Sandbox. This method loads the entire file into memory, so it is not recommended
180
+ * for downloading large files.
181
+ *
182
+ * @param {string} remotePath - Path to the file to download. Relative paths are resolved based on the sandbox working directory.
183
+ * @param {number} [timeout] - Timeout for the download operation in seconds. 0 means no timeout.
184
+ * Default is 30 minutes.
185
+ * @returns {Promise<Buffer>} The file contents as a Buffer.
186
+ *
187
+ * @example
188
+ * // Download and process a file
189
+ * const fileBuffer = await fs.downloadFile('tmp/data.json');
190
+ * console.log('File content:', fileBuffer.toString());
191
+ */
192
+ downloadFile(remotePath: string, timeout?: number): Promise<Buffer>;
193
+ /**
194
+ * Downloads a file from the Sandbox and saves it to a local file. This method uses streaming to download the file,
195
+ * so it is recommended for downloading larger files.
196
+ *
197
+ * @param {string} remotePath - Path to the file to download in the Sandbox. Relative paths are resolved based on the sandbox working directory.
198
+ * @param {string} localPath - Path to save the downloaded file.
199
+ * @param {number} [timeout] - Timeout for the download operation in seconds. 0 means no timeout.
200
+ * Default is 30 minutes.
201
+ * @returns {Promise<void>}
202
+ *
203
+ * @example
204
+ * // Download and save a file
205
+ * await fs.downloadFile('tmp/data.json', 'local_file.json');
206
+ */
207
+ downloadFile(remotePath: string, localPath: string, timeout?: number): Promise<void>;
208
+ /**
209
+ * Downloads a single file from the Sandbox as a readable stream without buffering
210
+ * the entire file into memory. The returned stream can be piped directly to an HTTP
211
+ * response, a file write stream, or any other writable destination.
212
+ *
213
+ * This method is only supported in Node.js-compatible runtimes (Node.js, Bun).
214
+ * Browser and serverless environments should use {@link downloadFile} instead.
215
+ *
216
+ * @param {string} remotePath - Path to the file in the Sandbox. Relative paths are
217
+ * resolved based on the sandbox working directory.
218
+ * @param {number | DownloadStreamOptions} [timeoutOrOptions] - Timeout in seconds, or an options
219
+ * object with timeout, AbortSignal for cancellation, and/or onProgress callback.
220
+ * Default timeout is 30 minutes.
221
+ * @returns {Promise<Readable>} A Node.js Readable stream of the file content.
222
+ *
223
+ * @example
224
+ * // Pipe directly to an HTTP response
225
+ * const stream = await sandbox.fs.downloadFileStream('outputs/report.pdf');
226
+ * stream.pipe(res);
227
+ *
228
+ * @example
229
+ * // Download with progress tracking and cancellation
230
+ * const controller = new AbortController();
231
+ * const stream = await sandbox.fs.downloadFileStream('outputs/large-file.bin', {
232
+ * signal: controller.signal,
233
+ * onProgress: ({ bytesReceived, totalBytes }) => console.log(bytesReceived, totalBytes),
234
+ * });
235
+ * stream.pipe(createWriteStream('local-file.bin'));
236
+ */
237
+ downloadFileStream(remotePath: string, timeout?: number): Promise<Readable>;
238
+ downloadFileStream(remotePath: string, options?: DownloadStreamOptions): Promise<Readable>;
239
+ /**
240
+ * Downloads multiple files from the Sandbox. If the files already exist locally, they will be overwritten.
241
+ *
242
+ * @param {FileDownloadRequest[]} files - Array of file download requests.
243
+ * @param {number} [timeoutSec] - Timeout for the download operation in seconds. 0 means no timeout.
244
+ * Default is 30 minutes.
245
+ * @returns {Promise<FileDownloadResponse[]>} Array of download results.
246
+ *
247
+ * @throws {DaytonaError} If the request itself fails (network issues, invalid request/response, etc.). Individual
248
+ * file download errors are returned in `FileDownloadResponse.error`. When the daemon provides structured
249
+ * per-file metadata, it is also available in `FileDownloadResponse.errorDetails`.
250
+ *
251
+ * @example
252
+ * // Download multiple files
253
+ * const results = await fs.downloadFiles([
254
+ * { source: 'tmp/data.json' },
255
+ * { source: 'tmp/config.json', destination: 'local_config.json' }
256
+ * ]);
257
+ * results.forEach(result => {
258
+ * if (result.error) {
259
+ * console.error(`Error downloading ${result.source}: ${result.error}`);
260
+ * } else if (result.result) {
261
+ * console.log(`Downloaded ${result.source} to ${result.result}`);
262
+ * }
263
+ * });
264
+ */
265
+ downloadFiles(files: FileDownloadRequest[], timeoutSec?: number): Promise<FileDownloadResponse[]>;
266
+ /**
267
+ * Searches for text patterns within files in the Sandbox.
268
+ *
269
+ * @param {string} path - Directory to search in. Relative paths are resolved based on the sandbox working directory.
270
+ * @param {string} pattern - Search pattern
271
+ * @returns {Promise<Array<Match>>} Array of matches with file and line information
272
+ *
273
+ * @example
274
+ * // Find all TODO comments in TypeScript files
275
+ * const matches = await fs.findFiles('app/src', 'TODO:');
276
+ * matches.forEach(match => {
277
+ * console.log(`${match.file}:${match.line}: ${match.content}`);
278
+ * });
279
+ */
280
+ findFiles(path: string, pattern: string): Promise<Array<Match>>;
281
+ /**
282
+ * Retrieves detailed information about a file or directory.
283
+ *
284
+ * @param {string} path - Path to the file or directory. Relative paths are resolved based on the sandbox working directory.
285
+ * @returns {Promise<FileInfo>} Detailed file information including size, permissions, modification time
286
+ *
287
+ * @example
288
+ * // Get file details
289
+ * const info = await fs.getFileDetails('app/config.json');
290
+ * console.log(`Size: ${info.size}, Modified: ${info.modTime}`);
291
+ */
292
+ getFileDetails(path: string): Promise<FileInfo>;
293
+ /**
294
+ * Lists contents of a directory in the Sandbox.
295
+ *
296
+ * @param {string} path - Directory path to list. Relative paths are resolved based on the sandbox working directory.
297
+ * @returns {Promise<FileInfo[]>} Array of file and directory information
298
+ *
299
+ * @example
300
+ * // List directory contents
301
+ * const files = await fs.listFiles('app/src');
302
+ * files.forEach(file => {
303
+ * console.log(`${file.name} (${file.size} bytes)`);
304
+ * });
305
+ */
306
+ listFiles(path: string): Promise<FileInfo[]>;
307
+ /**
308
+ * Moves or renames a file or directory.
309
+ *
310
+ * @param {string} source - Source path. Relative paths are resolved based on the sandbox working directory.
311
+ * @param {string} destination - Destination path. Relative paths are resolved based on the sandbox working directory.
312
+ * @returns {Promise<void>}
313
+ *
314
+ * @example
315
+ * // Move a file to a new location
316
+ * await fs.moveFiles('app/temp/data.json', 'app/data/data.json');
317
+ */
318
+ moveFiles(source: string, destination: string): Promise<void>;
319
+ /**
320
+ * Replaces text content in multiple files.
321
+ *
322
+ * @param {string[]} files - Array of file paths to process. Relative paths are resolved based on the sandbox working directory.
323
+ * @param {string} pattern - Pattern to replace
324
+ * @param {string} newValue - Replacement text
325
+ * @returns {Promise<Array<ReplaceResult>>} Results of the replace operation for each file
326
+ *
327
+ * @example
328
+ * // Update version number across multiple files
329
+ * const results = await fs.replaceInFiles(
330
+ * ['app/package.json', 'app/version.ts'],
331
+ * '"version": "1.0.0"',
332
+ * '"version": "1.1.0"'
333
+ * );
334
+ */
335
+ replaceInFiles(files: string[], pattern: string, newValue: string): Promise<Array<ReplaceResult>>;
336
+ /**
337
+ * Searches for files and directories by name pattern in the Sandbox.
338
+ *
339
+ * @param {string} path - Directory to search in. Relative paths are resolved based on the sandbox working directory.
340
+ * @param {string} pattern - File name pattern (supports globs)
341
+ * @returns {Promise<SearchFilesResponse>} Search results with matching files
342
+ *
343
+ * @example
344
+ * // Find all TypeScript files
345
+ * const result = await fs.searchFiles('app', '*.ts');
346
+ * result.files.forEach(file => console.log(file));
347
+ */
348
+ searchFiles(path: string, pattern: string): Promise<SearchFilesResponse>;
349
+ /**
350
+ * Sets permissions and ownership for a file or directory.
351
+ *
352
+ * @param {string} path - Path to the file or directory. Relative paths are resolved based on the sandbox working directory.
353
+ * @param {FilePermissionsParams} permissions - Permission settings
354
+ * @returns {Promise<void>}
355
+ *
356
+ * @example
357
+ * // Set file permissions and ownership
358
+ * await fs.setFilePermissions('app/script.sh', {
359
+ * owner: 'daytona',
360
+ * group: 'users',
361
+ * mode: '755' // Execute permission for shell script
362
+ * });
363
+ */
364
+ setFilePermissions(path: string, permissions: FilePermissionsParams): Promise<void>;
365
+ /**
366
+ * Uploads a file to the Sandbox. This method loads the entire file into memory, so it is not recommended
367
+ * for uploading large files.
368
+ *
369
+ * @param {Buffer} file - Buffer of the file to upload.
370
+ * @param {string} remotePath - Destination path in the Sandbox. Relative paths are resolved based on the sandbox working directory.
371
+ * @param {number} [timeout] - Timeout for the upload operation in seconds. 0 means no timeout.
372
+ * Default is 30 minutes.
373
+ * @returns {Promise<void>}
374
+ *
375
+ * @example
376
+ * // Upload a configuration file
377
+ * await fs.uploadFile(Buffer.from('{"setting": "value"}'), 'tmp/config.json');
378
+ */
379
+ uploadFile(file: Buffer, remotePath: string, timeout?: number): Promise<void>;
380
+ /**
381
+ * Uploads a file from the local file system to the Sandbox. This method uses streaming to upload the file,
382
+ * so it is recommended for uploading larger files.
383
+ *
384
+ * @param {string} localPath - Path to the local file to upload.
385
+ * @param {string} remotePath - Destination path in the Sandbox. Relative paths are resolved based on the sandbox working directory.
386
+ * @param {number} [timeout] - Timeout for the upload operation in seconds. 0 means no timeout.
387
+ * Default is 30 minutes.
388
+ * @returns {Promise<void>}
389
+ *
390
+ * @example
391
+ * // Upload a local file
392
+ * await fs.uploadFile('local_file.txt', 'tmp/file.txt');
393
+ */
394
+ uploadFile(localPath: string, remotePath: string, timeout?: number): Promise<void>;
395
+ /**
396
+ * Uploads a single file to the Sandbox using true streaming, with optional progress
397
+ * tracking and cancellation. Memory usage stays flat regardless of source size: the
398
+ * SDK pipes the source through a transform that counts bytes and forwards to the
399
+ * underlying multipart upload without buffering the whole payload. The HTTP layer
400
+ * uses chunked transfer encoding, so the source's natural EOF terminates the upload —
401
+ * no advance size is needed.
402
+ *
403
+ * @param {UploadSource} source - The data to upload. Accepts the same `Buffer | string`
404
+ * inputs as {@link FileSystem.uploadFile}, plus Node `Readable` streams and Web
405
+ * `ReadableStream` instances. When a string is passed, it is treated as a local
406
+ * file path and read in streaming chunks.
407
+ * @param {string} remotePath - Destination path in the Sandbox. Relative paths are
408
+ * resolved against the sandbox working directory.
409
+ * @param {UploadStreamOptions} [options] - Streaming options: AbortSignal, onProgress
410
+ * callback, timeout.
411
+ * @returns {Promise<void>}
412
+ *
413
+ * @example
414
+ * // Upload a 2 GB file with progress tracking and the ability to cancel
415
+ * import { createReadStream } from 'fs';
416
+ * const controller = new AbortController();
417
+ * await sandbox.fs.uploadFileStream(createReadStream('big.bin'), 'tmp/big.bin', {
418
+ * signal: controller.signal,
419
+ * onProgress: ({ bytesSent }) => console.log(`${bytesSent} bytes sent`),
420
+ * });
421
+ */
422
+ uploadFileStream(source: UploadSource, remotePath: string, options?: UploadStreamOptions): Promise<void>;
423
+ /**
424
+ * Uploads multiple files to the Sandbox. If files already exist at the destination paths,
425
+ * they will be overwritten.
426
+ *
427
+ * @param {FileUpload[]} files - Array of files to upload.
428
+ * @param {number} [timeout] - Timeout for the upload operation in seconds. 0 means no timeout.
429
+ * Default is 30 minutes.
430
+ * @returns {Promise<void>}
431
+ *
432
+ * @example
433
+ * // Upload multiple text files
434
+ * const files = [
435
+ * {
436
+ * source: Buffer.from('Content of file 1'),
437
+ * destination: '/tmp/file1.txt'
438
+ * },
439
+ * {
440
+ * source: 'app/data/file2.txt',
441
+ * destination: '/tmp/file2.txt'
442
+ * },
443
+ * {
444
+ * source: Buffer.from('{"key": "value"}'),
445
+ * destination: '/tmp/config.json'
446
+ * }
447
+ * ];
448
+ * await fs.uploadFiles(files);
449
+ */
450
+ uploadFiles(files: FileUpload[], timeout?: number): Promise<void>;
451
+ private makeFilePayload;
452
+ }
453
+ //# sourceMappingURL=FileSystem.d.ts.map