@daytona/sdk 0.0.0-dev

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 (169) hide show
  1. package/LICENSE +190 -0
  2. package/README.md +180 -0
  3. package/cjs/CodeInterpreter.d.ts +95 -0
  4. package/cjs/CodeInterpreter.js +297 -0
  5. package/cjs/CodeInterpreter.js.map +1 -0
  6. package/cjs/ComputerUse.d.ts +539 -0
  7. package/cjs/ComputerUse.js +808 -0
  8. package/cjs/ComputerUse.js.map +1 -0
  9. package/cjs/Daytona.d.ts +357 -0
  10. package/cjs/Daytona.js +534 -0
  11. package/cjs/Daytona.js.map +1 -0
  12. package/cjs/FileSystem.d.ts +453 -0
  13. package/cjs/FileSystem.js +575 -0
  14. package/cjs/FileSystem.js.map +1 -0
  15. package/cjs/Git.d.ts +203 -0
  16. package/cjs/Git.js +326 -0
  17. package/cjs/Git.js.map +1 -0
  18. package/cjs/Image.d.ts +265 -0
  19. package/cjs/Image.js +586 -0
  20. package/cjs/Image.js.map +1 -0
  21. package/cjs/LspServer.d.ts +172 -0
  22. package/cjs/LspServer.js +259 -0
  23. package/cjs/LspServer.js.map +1 -0
  24. package/cjs/ObjectStorage.d.ts +79 -0
  25. package/cjs/ObjectStorage.js +199 -0
  26. package/cjs/ObjectStorage.js.map +1 -0
  27. package/cjs/Process.d.ts +490 -0
  28. package/cjs/Process.js +647 -0
  29. package/cjs/Process.js.map +1 -0
  30. package/cjs/PtyHandle.d.ts +155 -0
  31. package/cjs/PtyHandle.js +416 -0
  32. package/cjs/PtyHandle.js.map +1 -0
  33. package/cjs/README.md +180 -0
  34. package/cjs/Sandbox.d.ts +476 -0
  35. package/cjs/Sandbox.js +905 -0
  36. package/cjs/Sandbox.js.map +1 -0
  37. package/cjs/Snapshot.d.ts +140 -0
  38. package/cjs/Snapshot.js +248 -0
  39. package/cjs/Snapshot.js.map +1 -0
  40. package/cjs/Volume.d.ts +84 -0
  41. package/cjs/Volume.js +119 -0
  42. package/cjs/Volume.js.map +1 -0
  43. package/cjs/errors/DaytonaError.d.ts +171 -0
  44. package/cjs/errors/DaytonaError.js +258 -0
  45. package/cjs/errors/DaytonaError.js.map +1 -0
  46. package/cjs/index.d.ts +22 -0
  47. package/cjs/index.js +49 -0
  48. package/cjs/index.js.map +1 -0
  49. package/cjs/package.json +3 -0
  50. package/cjs/types/Charts.d.ts +38 -0
  51. package/cjs/types/Charts.js +37 -0
  52. package/cjs/types/Charts.js.map +1 -0
  53. package/cjs/types/CodeInterpreter.d.ts +77 -0
  54. package/cjs/types/CodeInterpreter.js +7 -0
  55. package/cjs/types/CodeInterpreter.js.map +1 -0
  56. package/cjs/types/ExecuteResponse.d.ts +26 -0
  57. package/cjs/types/ExecuteResponse.js +7 -0
  58. package/cjs/types/ExecuteResponse.js.map +1 -0
  59. package/cjs/types/Pty.d.ts +48 -0
  60. package/cjs/types/Pty.js +7 -0
  61. package/cjs/types/Pty.js.map +1 -0
  62. package/cjs/utils/Binary.d.ts +38 -0
  63. package/cjs/utils/Binary.js +174 -0
  64. package/cjs/utils/Binary.js.map +1 -0
  65. package/cjs/utils/FileTransfer.d.ts +39 -0
  66. package/cjs/utils/FileTransfer.js +521 -0
  67. package/cjs/utils/FileTransfer.js.map +1 -0
  68. package/cjs/utils/Import.d.ts +40 -0
  69. package/cjs/utils/Import.js +155 -0
  70. package/cjs/utils/Import.js.map +1 -0
  71. package/cjs/utils/Multipart.d.ts +29 -0
  72. package/cjs/utils/Multipart.js +115 -0
  73. package/cjs/utils/Multipart.js.map +1 -0
  74. package/cjs/utils/Runtime.d.ts +44 -0
  75. package/cjs/utils/Runtime.js +95 -0
  76. package/cjs/utils/Runtime.js.map +1 -0
  77. package/cjs/utils/Stream.d.ts +20 -0
  78. package/cjs/utils/Stream.js +364 -0
  79. package/cjs/utils/Stream.js.map +1 -0
  80. package/cjs/utils/WebSocket.d.ts +10 -0
  81. package/cjs/utils/WebSocket.js +26 -0
  82. package/cjs/utils/WebSocket.js.map +1 -0
  83. package/cjs/utils/otel.decorator.d.ts +83 -0
  84. package/cjs/utils/otel.decorator.js +141 -0
  85. package/cjs/utils/otel.decorator.js.map +1 -0
  86. package/esm/CodeInterpreter.d.ts +95 -0
  87. package/esm/CodeInterpreter.js +292 -0
  88. package/esm/CodeInterpreter.js.map +1 -0
  89. package/esm/ComputerUse.d.ts +539 -0
  90. package/esm/ComputerUse.js +799 -0
  91. package/esm/ComputerUse.js.map +1 -0
  92. package/esm/Daytona.d.ts +357 -0
  93. package/esm/Daytona.js +530 -0
  94. package/esm/Daytona.js.map +1 -0
  95. package/esm/FileSystem.d.ts +453 -0
  96. package/esm/FileSystem.js +571 -0
  97. package/esm/FileSystem.js.map +1 -0
  98. package/esm/Git.d.ts +203 -0
  99. package/esm/Git.js +322 -0
  100. package/esm/Git.js.map +1 -0
  101. package/esm/Image.d.ts +265 -0
  102. package/esm/Image.js +581 -0
  103. package/esm/Image.js.map +1 -0
  104. package/esm/LspServer.d.ts +172 -0
  105. package/esm/LspServer.js +255 -0
  106. package/esm/LspServer.js.map +1 -0
  107. package/esm/ObjectStorage.d.ts +79 -0
  108. package/esm/ObjectStorage.js +195 -0
  109. package/esm/ObjectStorage.js.map +1 -0
  110. package/esm/Process.d.ts +490 -0
  111. package/esm/Process.js +642 -0
  112. package/esm/Process.js.map +1 -0
  113. package/esm/PtyHandle.d.ts +155 -0
  114. package/esm/PtyHandle.js +412 -0
  115. package/esm/PtyHandle.js.map +1 -0
  116. package/esm/README.md +180 -0
  117. package/esm/Sandbox.d.ts +476 -0
  118. package/esm/Sandbox.js +901 -0
  119. package/esm/Sandbox.js.map +1 -0
  120. package/esm/Snapshot.d.ts +140 -0
  121. package/esm/Snapshot.js +244 -0
  122. package/esm/Snapshot.js.map +1 -0
  123. package/esm/Volume.d.ts +84 -0
  124. package/esm/Volume.js +115 -0
  125. package/esm/Volume.js.map +1 -0
  126. package/esm/errors/DaytonaError.d.ts +171 -0
  127. package/esm/errors/DaytonaError.js +243 -0
  128. package/esm/errors/DaytonaError.js.map +1 -0
  129. package/esm/index.d.ts +22 -0
  130. package/esm/index.js +21 -0
  131. package/esm/index.js.map +1 -0
  132. package/esm/package.json +3 -0
  133. package/esm/types/Charts.d.ts +38 -0
  134. package/esm/types/Charts.js +33 -0
  135. package/esm/types/Charts.js.map +1 -0
  136. package/esm/types/CodeInterpreter.d.ts +77 -0
  137. package/esm/types/CodeInterpreter.js +6 -0
  138. package/esm/types/CodeInterpreter.js.map +1 -0
  139. package/esm/types/ExecuteResponse.d.ts +26 -0
  140. package/esm/types/ExecuteResponse.js +6 -0
  141. package/esm/types/ExecuteResponse.js.map +1 -0
  142. package/esm/types/Pty.d.ts +48 -0
  143. package/esm/types/Pty.js +6 -0
  144. package/esm/types/Pty.js.map +1 -0
  145. package/esm/utils/Binary.d.ts +38 -0
  146. package/esm/utils/Binary.js +163 -0
  147. package/esm/utils/Binary.js.map +1 -0
  148. package/esm/utils/FileTransfer.d.ts +39 -0
  149. package/esm/utils/FileTransfer.js +512 -0
  150. package/esm/utils/FileTransfer.js.map +1 -0
  151. package/esm/utils/Import.d.ts +40 -0
  152. package/esm/utils/Import.js +119 -0
  153. package/esm/utils/Import.js.map +1 -0
  154. package/esm/utils/Multipart.d.ts +29 -0
  155. package/esm/utils/Multipart.js +109 -0
  156. package/esm/utils/Multipart.js.map +1 -0
  157. package/esm/utils/Runtime.d.ts +44 -0
  158. package/esm/utils/Runtime.js +89 -0
  159. package/esm/utils/Runtime.js.map +1 -0
  160. package/esm/utils/Stream.d.ts +20 -0
  161. package/esm/utils/Stream.js +360 -0
  162. package/esm/utils/Stream.js.map +1 -0
  163. package/esm/utils/WebSocket.d.ts +10 -0
  164. package/esm/utils/WebSocket.js +22 -0
  165. package/esm/utils/WebSocket.js.map +1 -0
  166. package/esm/utils/otel.decorator.d.ts +83 -0
  167. package/esm/utils/otel.decorator.js +136 -0
  168. package/esm/utils/otel.decorator.js.map +1 -0
  169. package/package.json +96 -0
@@ -0,0 +1,575 @@
1
+ "use strict";
2
+ /*
3
+ * Copyright 2025 Daytona Platforms Inc.
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.FileSystem = void 0;
8
+ const tslib_1 = require("tslib");
9
+ const pathe = tslib_1.__importStar(require("pathe"));
10
+ const axios_1 = tslib_1.__importDefault(require("axios"));
11
+ const Import_1 = require("./utils/Import");
12
+ const Runtime_1 = require("./utils/Runtime");
13
+ const DaytonaError_1 = require("./errors/DaytonaError");
14
+ const FileTransfer_1 = require("./utils/FileTransfer");
15
+ const otel_decorator_1 = require("./utils/otel.decorator");
16
+ function createFileDownloadError(error, errorDetails) {
17
+ if (!errorDetails) {
18
+ return new DaytonaError_1.DaytonaError(error);
19
+ }
20
+ return (0, DaytonaError_1.createDaytonaError)(errorDetails.message, errorDetails.statusCode, undefined, errorDetails.errorCode);
21
+ }
22
+ /**
23
+ * Provides file system operations within a Sandbox.
24
+ *
25
+ * @class
26
+ */
27
+ class FileSystem {
28
+ clientConfig;
29
+ apiClient;
30
+ constructor(clientConfig, apiClient) {
31
+ this.clientConfig = clientConfig;
32
+ this.apiClient = apiClient;
33
+ }
34
+ /**
35
+ * Create a new directory in the Sandbox with specified permissions.
36
+ *
37
+ * @param {string} path - Path where the directory should be created. Relative paths are resolved based on the sandbox working directory.
38
+ * @param {string} mode - Directory permissions in octal format (e.g. "755")
39
+ * @returns {Promise<void>}
40
+ *
41
+ * @example
42
+ * // Create a directory with standard permissions
43
+ * await fs.createFolder('app/data', '755');
44
+ */
45
+ async createFolder(path, mode) {
46
+ const response = await this.apiClient.createFolder(path, mode);
47
+ return response.data;
48
+ }
49
+ /**
50
+ * Deletes a file or directory from the Sandbox.
51
+ *
52
+ * @param {string} path - Path to the file or directory to delete. Relative paths are resolved based on the sandbox working directory.
53
+ * @param {boolean} [recursive] - If the file is a directory, this must be true to delete it.
54
+ * @returns {Promise<void>}
55
+ *
56
+ * @example
57
+ * // Delete a file
58
+ * await fs.deleteFile('app/temp.log');
59
+ */
60
+ async deleteFile(path, recursive) {
61
+ const response = await this.apiClient.deleteFile(path, recursive);
62
+ return response.data;
63
+ }
64
+ async downloadFile(src, dst, timeout = 30 * 60) {
65
+ const remotePath = src;
66
+ if (typeof dst !== 'string') {
67
+ if (dst) {
68
+ timeout = dst;
69
+ }
70
+ const response = await this.downloadFiles([{ source: remotePath }], timeout);
71
+ if (response[0].error) {
72
+ throw createFileDownloadError(response[0].error, response[0].errorDetails);
73
+ }
74
+ return response[0].result;
75
+ }
76
+ const response = await this.downloadFiles([{ source: remotePath, destination: dst }], timeout);
77
+ if (response[0].error) {
78
+ throw createFileDownloadError(response[0].error, response[0].errorDetails);
79
+ }
80
+ }
81
+ async downloadFileStream(remotePath, timeoutOrOptions) {
82
+ const options = typeof timeoutOrOptions === 'number' ? { timeout: timeoutOrOptions } : (timeoutOrOptions ?? {});
83
+ const timeout = options.timeout ?? 30 * 60;
84
+ const isNonStreamingRuntime = Runtime_1.RUNTIME === Runtime_1.Runtime.BROWSER || Runtime_1.RUNTIME === Runtime_1.Runtime.SERVERLESS;
85
+ if (isNonStreamingRuntime) {
86
+ throw new DaytonaError_1.DaytonaError('downloadFileStream is not supported in browser or serverless environments. Use downloadFile instead.');
87
+ }
88
+ if (options.signal?.aborted) {
89
+ throw new DaytonaError_1.DaytonaError('Download cancelled');
90
+ }
91
+ const toDownloadCancelledError = () => new DaytonaError_1.DaytonaError('Download cancelled');
92
+ const isCanceledError = (err) => {
93
+ const error = err;
94
+ return Boolean(axios_1.default.isCancel?.(err) || error?.name === 'CanceledError' || error?.code === 'ERR_CANCELED');
95
+ };
96
+ let response;
97
+ try {
98
+ response = await this.apiClient.downloadFiles({ paths: [remotePath] }, {
99
+ responseType: 'stream',
100
+ timeout: timeout * 1000,
101
+ signal: options.signal,
102
+ });
103
+ }
104
+ catch (err) {
105
+ if (options.signal?.aborted || isCanceledError(err)) {
106
+ throw toDownloadCancelledError();
107
+ }
108
+ throw err;
109
+ }
110
+ const responseStream = (0, FileTransfer_1.normalizeResponseStream)(response.data);
111
+ const metadataMap = new Map();
112
+ metadataMap.set(remotePath, {});
113
+ return new Promise((resolve, reject) => {
114
+ let resolvedStream = null;
115
+ (0, FileTransfer_1.processDownloadFilesResponseWithBusboy)(responseStream, response.headers, metadataMap, (_source, fileStream, totalBytes) => {
116
+ if (options.onProgress) {
117
+ const { Transform } = require('stream');
118
+ let bytesReceived = 0;
119
+ const progress = new Transform({
120
+ transform(chunk, _encoding, callback) {
121
+ bytesReceived += chunk.length;
122
+ options.onProgress({ bytesReceived, totalBytes });
123
+ callback(null, chunk);
124
+ },
125
+ });
126
+ fileStream.pipe(progress);
127
+ fileStream.on('error', (err) => {
128
+ if (!progress.destroyed)
129
+ progress.destroy(err);
130
+ });
131
+ resolvedStream = progress;
132
+ }
133
+ else {
134
+ resolvedStream = fileStream;
135
+ }
136
+ resolve(resolvedStream);
137
+ })
138
+ .then(() => {
139
+ if (!resolvedStream) {
140
+ const metadata = metadataMap.get(remotePath);
141
+ if (metadata?.error) {
142
+ reject(createFileDownloadError(metadata.error, metadata.errorDetails));
143
+ }
144
+ else {
145
+ reject(new DaytonaError_1.DaytonaError(`No file data received for: ${remotePath}`));
146
+ }
147
+ }
148
+ })
149
+ .catch((err) => {
150
+ const normalizedError = options.signal?.aborted || isCanceledError(err) ? toDownloadCancelledError() : err;
151
+ if (!resolvedStream) {
152
+ reject(normalizedError);
153
+ return;
154
+ }
155
+ const stream = resolvedStream;
156
+ if (stream.destroyed || stream.readableEnded) {
157
+ return;
158
+ }
159
+ stream.destroy(normalizedError instanceof Error ? normalizedError : new Error(String(normalizedError)));
160
+ });
161
+ });
162
+ }
163
+ /**
164
+ * Downloads multiple files from the Sandbox. If the files already exist locally, they will be overwritten.
165
+ *
166
+ * @param {FileDownloadRequest[]} files - Array of file download requests.
167
+ * @param {number} [timeoutSec] - Timeout for the download operation in seconds. 0 means no timeout.
168
+ * Default is 30 minutes.
169
+ * @returns {Promise<FileDownloadResponse[]>} Array of download results.
170
+ *
171
+ * @throws {DaytonaError} If the request itself fails (network issues, invalid request/response, etc.). Individual
172
+ * file download errors are returned in `FileDownloadResponse.error`. When the daemon provides structured
173
+ * per-file metadata, it is also available in `FileDownloadResponse.errorDetails`.
174
+ *
175
+ * @example
176
+ * // Download multiple files
177
+ * const results = await fs.downloadFiles([
178
+ * { source: 'tmp/data.json' },
179
+ * { source: 'tmp/config.json', destination: 'local_config.json' }
180
+ * ]);
181
+ * results.forEach(result => {
182
+ * if (result.error) {
183
+ * console.error(`Error downloading ${result.source}: ${result.error}`);
184
+ * } else if (result.result) {
185
+ * console.log(`Downloaded ${result.source} to ${result.result}`);
186
+ * }
187
+ * });
188
+ */
189
+ async downloadFiles(files, timeoutSec = 30 * 60) {
190
+ if (files.length === 0)
191
+ return [];
192
+ const isNonStreamingRuntime = Runtime_1.RUNTIME === Runtime_1.Runtime.BROWSER || Runtime_1.RUNTIME === Runtime_1.Runtime.SERVERLESS;
193
+ // Prepare destinations and metadata
194
+ const metadataMap = new Map();
195
+ for (const f of files) {
196
+ metadataMap.set(f.source, { destination: f.destination });
197
+ if (f.destination) {
198
+ const fs = await (0, Import_1.dynamicImport)('fs', 'Downloading files to local files is not supported: ');
199
+ await fs.promises.mkdir(pathe.dirname(f.destination), { recursive: true });
200
+ }
201
+ }
202
+ const response = await this.apiClient.downloadFiles({ paths: files.map((f) => f.source) }, {
203
+ responseType: isNonStreamingRuntime ? 'arraybuffer' : 'stream',
204
+ timeout: timeoutSec * 1000,
205
+ });
206
+ const stream = (0, FileTransfer_1.normalizeResponseStream)(response.data);
207
+ // Node.js path: use busboy for efficient streaming
208
+ if (isNonStreamingRuntime) {
209
+ await (0, FileTransfer_1.processDownloadFilesResponseWithBuffered)(stream, response.headers, metadataMap);
210
+ }
211
+ else {
212
+ await (0, FileTransfer_1.processDownloadFilesResponseWithBusboy)(stream, response.headers, metadataMap);
213
+ }
214
+ return files.map((f) => {
215
+ const metadata = metadataMap.get(f.source);
216
+ const error = metadata?.error || (!metadata?.result ? 'No data received for this file' : undefined);
217
+ return {
218
+ source: f.source,
219
+ result: error ? undefined : metadata.result,
220
+ error,
221
+ errorDetails: error ? metadata?.errorDetails : undefined,
222
+ };
223
+ });
224
+ }
225
+ /**
226
+ * Searches for text patterns within files in the Sandbox.
227
+ *
228
+ * @param {string} path - Directory to search in. Relative paths are resolved based on the sandbox working directory.
229
+ * @param {string} pattern - Search pattern
230
+ * @returns {Promise<Array<Match>>} Array of matches with file and line information
231
+ *
232
+ * @example
233
+ * // Find all TODO comments in TypeScript files
234
+ * const matches = await fs.findFiles('app/src', 'TODO:');
235
+ * matches.forEach(match => {
236
+ * console.log(`${match.file}:${match.line}: ${match.content}`);
237
+ * });
238
+ */
239
+ async findFiles(path, pattern) {
240
+ const response = await this.apiClient.findInFiles(path, pattern);
241
+ return response.data;
242
+ }
243
+ /**
244
+ * Retrieves detailed information about a file or directory.
245
+ *
246
+ * @param {string} path - Path to the file or directory. Relative paths are resolved based on the sandbox working directory.
247
+ * @returns {Promise<FileInfo>} Detailed file information including size, permissions, modification time
248
+ *
249
+ * @example
250
+ * // Get file details
251
+ * const info = await fs.getFileDetails('app/config.json');
252
+ * console.log(`Size: ${info.size}, Modified: ${info.modTime}`);
253
+ */
254
+ async getFileDetails(path) {
255
+ const response = await this.apiClient.getFileInfo(path);
256
+ return response.data;
257
+ }
258
+ /**
259
+ * Lists contents of a directory in the Sandbox.
260
+ *
261
+ * @param {string} path - Directory path to list. Relative paths are resolved based on the sandbox working directory.
262
+ * @returns {Promise<FileInfo[]>} Array of file and directory information
263
+ *
264
+ * @example
265
+ * // List directory contents
266
+ * const files = await fs.listFiles('app/src');
267
+ * files.forEach(file => {
268
+ * console.log(`${file.name} (${file.size} bytes)`);
269
+ * });
270
+ */
271
+ async listFiles(path) {
272
+ const response = await this.apiClient.listFiles(path);
273
+ return response.data;
274
+ }
275
+ /**
276
+ * Moves or renames a file or directory.
277
+ *
278
+ * @param {string} source - Source path. Relative paths are resolved based on the sandbox working directory.
279
+ * @param {string} destination - Destination path. Relative paths are resolved based on the sandbox working directory.
280
+ * @returns {Promise<void>}
281
+ *
282
+ * @example
283
+ * // Move a file to a new location
284
+ * await fs.moveFiles('app/temp/data.json', 'app/data/data.json');
285
+ */
286
+ async moveFiles(source, destination) {
287
+ const response = await this.apiClient.moveFile(source, destination);
288
+ return response.data;
289
+ }
290
+ /**
291
+ * Replaces text content in multiple files.
292
+ *
293
+ * @param {string[]} files - Array of file paths to process. Relative paths are resolved based on the sandbox working directory.
294
+ * @param {string} pattern - Pattern to replace
295
+ * @param {string} newValue - Replacement text
296
+ * @returns {Promise<Array<ReplaceResult>>} Results of the replace operation for each file
297
+ *
298
+ * @example
299
+ * // Update version number across multiple files
300
+ * const results = await fs.replaceInFiles(
301
+ * ['app/package.json', 'app/version.ts'],
302
+ * '"version": "1.0.0"',
303
+ * '"version": "1.1.0"'
304
+ * );
305
+ */
306
+ async replaceInFiles(files, pattern, newValue) {
307
+ const replaceRequest = {
308
+ files,
309
+ newValue,
310
+ pattern,
311
+ };
312
+ const response = await this.apiClient.replaceInFiles(replaceRequest);
313
+ return response.data;
314
+ }
315
+ /**
316
+ * Searches for files and directories by name pattern in the Sandbox.
317
+ *
318
+ * @param {string} path - Directory to search in. Relative paths are resolved based on the sandbox working directory.
319
+ * @param {string} pattern - File name pattern (supports globs)
320
+ * @returns {Promise<SearchFilesResponse>} Search results with matching files
321
+ *
322
+ * @example
323
+ * // Find all TypeScript files
324
+ * const result = await fs.searchFiles('app', '*.ts');
325
+ * result.files.forEach(file => console.log(file));
326
+ */
327
+ async searchFiles(path, pattern) {
328
+ const response = await this.apiClient.searchFiles(path, pattern);
329
+ return response.data;
330
+ }
331
+ /**
332
+ * Sets permissions and ownership for a file or directory.
333
+ *
334
+ * @param {string} path - Path to the file or directory. Relative paths are resolved based on the sandbox working directory.
335
+ * @param {FilePermissionsParams} permissions - Permission settings
336
+ * @returns {Promise<void>}
337
+ *
338
+ * @example
339
+ * // Set file permissions and ownership
340
+ * await fs.setFilePermissions('app/script.sh', {
341
+ * owner: 'daytona',
342
+ * group: 'users',
343
+ * mode: '755' // Execute permission for shell script
344
+ * });
345
+ */
346
+ async setFilePermissions(path, permissions) {
347
+ const response = await this.apiClient.setFilePermissions(path, permissions.owner, permissions.group, permissions.mode);
348
+ return response.data;
349
+ }
350
+ async uploadFile(src, dst, timeout = 30 * 60) {
351
+ await this.uploadFiles([{ source: src, destination: dst }], timeout);
352
+ }
353
+ /**
354
+ * Uploads a single file to the Sandbox using true streaming, with optional progress
355
+ * tracking and cancellation. Memory usage stays flat regardless of source size: the
356
+ * SDK pipes the source through a transform that counts bytes and forwards to the
357
+ * underlying multipart upload without buffering the whole payload. The HTTP layer
358
+ * uses chunked transfer encoding, so the source's natural EOF terminates the upload —
359
+ * no advance size is needed.
360
+ *
361
+ * @param {UploadSource} source - The data to upload. Accepts the same `Buffer | string`
362
+ * inputs as {@link FileSystem.uploadFile}, plus Node `Readable` streams and Web
363
+ * `ReadableStream` instances. When a string is passed, it is treated as a local
364
+ * file path and read in streaming chunks.
365
+ * @param {string} remotePath - Destination path in the Sandbox. Relative paths are
366
+ * resolved against the sandbox working directory.
367
+ * @param {UploadStreamOptions} [options] - Streaming options: AbortSignal, onProgress
368
+ * callback, timeout.
369
+ * @returns {Promise<void>}
370
+ *
371
+ * @example
372
+ * // Upload a 2 GB file with progress tracking and the ability to cancel
373
+ * import { createReadStream } from 'fs';
374
+ * const controller = new AbortController();
375
+ * await sandbox.fs.uploadFileStream(createReadStream('big.bin'), 'tmp/big.bin', {
376
+ * signal: controller.signal,
377
+ * onProgress: ({ bytesSent }) => console.log(`${bytesSent} bytes sent`),
378
+ * });
379
+ */
380
+ async uploadFileStream(source, remotePath, options = {}) {
381
+ const isNonStreamingRuntime = Runtime_1.RUNTIME === Runtime_1.Runtime.DENO || Runtime_1.RUNTIME === Runtime_1.Runtime.BROWSER || Runtime_1.RUNTIME === Runtime_1.Runtime.SERVERLESS;
382
+ if (isNonStreamingRuntime) {
383
+ throw new DaytonaError_1.DaytonaError('uploadFileStream is not supported in browser, Deno, or serverless runtimes. Use uploadFile instead.');
384
+ }
385
+ if (options.signal?.aborted) {
386
+ throw (0, FileTransfer_1.createAbortError)(remotePath);
387
+ }
388
+ const timeout = options.timeout ?? 30 * 60;
389
+ const sourceStream = await (0, FileTransfer_1.coerceUploadSource)(source);
390
+ const tracked = (0, FileTransfer_1.wrapWithUploadProgress)(sourceStream, options.onProgress, options.signal);
391
+ const FormDataClass = (await (0, Import_1.dynamicImport)('form-data', 'Uploading files is not supported: '));
392
+ const form = new FormDataClass();
393
+ form.append('files[0].path', remotePath);
394
+ // No knownLength: form-data falls back to chunked transfer encoding, which the
395
+ // daemon's MultipartReader handles transparently. The source's EOF terminates
396
+ // the upload — no advance byte count needed.
397
+ form.append('files[0].file', tracked, { filename: remotePath });
398
+ try {
399
+ await this.apiClient.uploadFiles({
400
+ data: form,
401
+ maxRedirects: 0,
402
+ timeout: timeout * 1000,
403
+ signal: options.signal,
404
+ });
405
+ }
406
+ catch (err) {
407
+ if (options.signal?.aborted) {
408
+ throw (0, FileTransfer_1.createAbortError)(remotePath);
409
+ }
410
+ throw err;
411
+ }
412
+ }
413
+ /**
414
+ * Uploads multiple files to the Sandbox. If files already exist at the destination paths,
415
+ * they will be overwritten.
416
+ *
417
+ * @param {FileUpload[]} files - Array of files to upload.
418
+ * @param {number} [timeout] - Timeout for the upload operation in seconds. 0 means no timeout.
419
+ * Default is 30 minutes.
420
+ * @returns {Promise<void>}
421
+ *
422
+ * @example
423
+ * // Upload multiple text files
424
+ * const files = [
425
+ * {
426
+ * source: Buffer.from('Content of file 1'),
427
+ * destination: '/tmp/file1.txt'
428
+ * },
429
+ * {
430
+ * source: 'app/data/file2.txt',
431
+ * destination: '/tmp/file2.txt'
432
+ * },
433
+ * {
434
+ * source: Buffer.from('{"key": "value"}'),
435
+ * destination: '/tmp/config.json'
436
+ * }
437
+ * ];
438
+ * await fs.uploadFiles(files);
439
+ */
440
+ async uploadFiles(files, timeout = 30 * 60) {
441
+ const isNonStreamingRuntime = Runtime_1.RUNTIME === Runtime_1.Runtime.DENO || Runtime_1.RUNTIME === Runtime_1.Runtime.BROWSER || Runtime_1.RUNTIME === Runtime_1.Runtime.SERVERLESS;
442
+ const FormDataClass = isNonStreamingRuntime
443
+ ? FormData
444
+ : (await (0, Import_1.dynamicImport)('form-data', 'Uploading files is not supported: '));
445
+ const form = new FormDataClass();
446
+ for (const [i, { source, destination }] of files.entries()) {
447
+ form.append(`files[${i}].path`, destination);
448
+ const payload = await this.makeFilePayload(source);
449
+ form.append(`files[${i}].file`, payload, destination);
450
+ }
451
+ if (isNonStreamingRuntime) {
452
+ const url = `${this.clientConfig.basePath}/files/bulk-upload`;
453
+ await fetch(url, {
454
+ method: 'POST',
455
+ headers: this.clientConfig.baseOptions.headers,
456
+ body: form,
457
+ signal: timeout ? AbortSignal.timeout(timeout * 1000) : undefined,
458
+ });
459
+ }
460
+ else {
461
+ await this.apiClient.uploadFiles({
462
+ data: form,
463
+ maxRedirects: 0,
464
+ timeout: timeout * 1000,
465
+ });
466
+ }
467
+ }
468
+ async makeFilePayload(source) {
469
+ // String = file path
470
+ if (typeof source === 'string') {
471
+ const fs = await (0, Import_1.dynamicImport)('fs', 'Uploading file from local file system is not supported: ');
472
+ return fs.createReadStream(source);
473
+ }
474
+ // Blob
475
+ if (Runtime_1.RUNTIME === Runtime_1.Runtime.BROWSER || Runtime_1.RUNTIME === Runtime_1.Runtime.SERVERLESS || Runtime_1.RUNTIME === Runtime_1.Runtime.DENO) {
476
+ // Use .slice() to ensure we have a concrete ArrayBuffer, not ArrayBufferLike
477
+ return new Blob([source.slice()], { type: 'application/octet-stream' });
478
+ }
479
+ // Readable stream
480
+ const stream = await (0, Import_1.dynamicImport)('stream', 'Uploading file is not supported: ');
481
+ return stream.Readable.from(source);
482
+ }
483
+ }
484
+ exports.FileSystem = FileSystem;
485
+ tslib_1.__decorate([
486
+ (0, otel_decorator_1.WithInstrumentation)(),
487
+ tslib_1.__metadata("design:type", Function),
488
+ tslib_1.__metadata("design:paramtypes", [String, String]),
489
+ tslib_1.__metadata("design:returntype", Promise)
490
+ ], FileSystem.prototype, "createFolder", null);
491
+ tslib_1.__decorate([
492
+ (0, otel_decorator_1.WithInstrumentation)(),
493
+ tslib_1.__metadata("design:type", Function),
494
+ tslib_1.__metadata("design:paramtypes", [String, Boolean]),
495
+ tslib_1.__metadata("design:returntype", Promise)
496
+ ], FileSystem.prototype, "deleteFile", null);
497
+ tslib_1.__decorate([
498
+ (0, otel_decorator_1.WithInstrumentation)(),
499
+ tslib_1.__metadata("design:type", Function),
500
+ tslib_1.__metadata("design:paramtypes", [String, Object, Number]),
501
+ tslib_1.__metadata("design:returntype", Promise)
502
+ ], FileSystem.prototype, "downloadFile", null);
503
+ tslib_1.__decorate([
504
+ (0, otel_decorator_1.WithInstrumentation)(),
505
+ tslib_1.__metadata("design:type", Function),
506
+ tslib_1.__metadata("design:paramtypes", [String, Object]),
507
+ tslib_1.__metadata("design:returntype", Promise)
508
+ ], FileSystem.prototype, "downloadFileStream", null);
509
+ tslib_1.__decorate([
510
+ (0, otel_decorator_1.WithInstrumentation)(),
511
+ tslib_1.__metadata("design:type", Function),
512
+ tslib_1.__metadata("design:paramtypes", [Array, Number]),
513
+ tslib_1.__metadata("design:returntype", Promise)
514
+ ], FileSystem.prototype, "downloadFiles", null);
515
+ tslib_1.__decorate([
516
+ (0, otel_decorator_1.WithInstrumentation)(),
517
+ tslib_1.__metadata("design:type", Function),
518
+ tslib_1.__metadata("design:paramtypes", [String, String]),
519
+ tslib_1.__metadata("design:returntype", Promise)
520
+ ], FileSystem.prototype, "findFiles", null);
521
+ tslib_1.__decorate([
522
+ (0, otel_decorator_1.WithInstrumentation)(),
523
+ tslib_1.__metadata("design:type", Function),
524
+ tslib_1.__metadata("design:paramtypes", [String]),
525
+ tslib_1.__metadata("design:returntype", Promise)
526
+ ], FileSystem.prototype, "getFileDetails", null);
527
+ tslib_1.__decorate([
528
+ (0, otel_decorator_1.WithInstrumentation)(),
529
+ tslib_1.__metadata("design:type", Function),
530
+ tslib_1.__metadata("design:paramtypes", [String]),
531
+ tslib_1.__metadata("design:returntype", Promise)
532
+ ], FileSystem.prototype, "listFiles", null);
533
+ tslib_1.__decorate([
534
+ (0, otel_decorator_1.WithInstrumentation)(),
535
+ tslib_1.__metadata("design:type", Function),
536
+ tslib_1.__metadata("design:paramtypes", [String, String]),
537
+ tslib_1.__metadata("design:returntype", Promise)
538
+ ], FileSystem.prototype, "moveFiles", null);
539
+ tslib_1.__decorate([
540
+ (0, otel_decorator_1.WithInstrumentation)(),
541
+ tslib_1.__metadata("design:type", Function),
542
+ tslib_1.__metadata("design:paramtypes", [Array, String, String]),
543
+ tslib_1.__metadata("design:returntype", Promise)
544
+ ], FileSystem.prototype, "replaceInFiles", null);
545
+ tslib_1.__decorate([
546
+ (0, otel_decorator_1.WithInstrumentation)(),
547
+ tslib_1.__metadata("design:type", Function),
548
+ tslib_1.__metadata("design:paramtypes", [String, String]),
549
+ tslib_1.__metadata("design:returntype", Promise)
550
+ ], FileSystem.prototype, "searchFiles", null);
551
+ tslib_1.__decorate([
552
+ (0, otel_decorator_1.WithInstrumentation)(),
553
+ tslib_1.__metadata("design:type", Function),
554
+ tslib_1.__metadata("design:paramtypes", [String, Object]),
555
+ tslib_1.__metadata("design:returntype", Promise)
556
+ ], FileSystem.prototype, "setFilePermissions", null);
557
+ tslib_1.__decorate([
558
+ (0, otel_decorator_1.WithInstrumentation)(),
559
+ tslib_1.__metadata("design:type", Function),
560
+ tslib_1.__metadata("design:paramtypes", [Object, String, Number]),
561
+ tslib_1.__metadata("design:returntype", Promise)
562
+ ], FileSystem.prototype, "uploadFile", null);
563
+ tslib_1.__decorate([
564
+ (0, otel_decorator_1.WithInstrumentation)(),
565
+ tslib_1.__metadata("design:type", Function),
566
+ tslib_1.__metadata("design:paramtypes", [Object, String, Object]),
567
+ tslib_1.__metadata("design:returntype", Promise)
568
+ ], FileSystem.prototype, "uploadFileStream", null);
569
+ tslib_1.__decorate([
570
+ (0, otel_decorator_1.WithInstrumentation)(),
571
+ tslib_1.__metadata("design:type", Function),
572
+ tslib_1.__metadata("design:paramtypes", [Array, Number]),
573
+ tslib_1.__metadata("design:returntype", Promise)
574
+ ], FileSystem.prototype, "uploadFiles", null);
575
+ //# sourceMappingURL=FileSystem.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FileSystem.js","sourceRoot":"","sources":["../../../../../libs/sdk-typescript/src/FileSystem.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;AAEH,qDAA8B;AAC9B,0DAAyB;AAUzB,2CAA8C;AAC9C,6CAAkD;AAClD,wDAAwE;AAExE,uDAO6B;AAC7B,2DAA4D;AA0J5D,SAAS,uBAAuB,CAAC,KAAa,EAAE,YAAuC;IACrF,IAAI,CAAC,YAAY,EAAE,CAAC;QAClB,OAAO,IAAI,2BAAY,CAAC,KAAK,CAAC,CAAA;IAChC,CAAC;IAED,OAAO,IAAA,iCAAkB,EAAC,YAAY,CAAC,OAAO,EAAE,YAAY,CAAC,UAAU,EAAE,SAAS,EAAE,YAAY,CAAC,SAAS,CAAC,CAAA;AAC7G,CAAC;AAED;;;;GAIG;AACH,MAAa,UAAU;IAEF;IACA;IAFnB,YACmB,YAA2B,EAC3B,SAAwB;QADxB,iBAAY,GAAZ,YAAY,CAAe;QAC3B,cAAS,GAAT,SAAS,CAAe;IACxC,CAAC;IAEJ;;;;;;;;;;OAUG;IAEU,AAAN,KAAK,CAAC,YAAY,CAAC,IAAY,EAAE,IAAY;QAClD,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA;QAC9D,OAAO,QAAQ,CAAC,IAAI,CAAA;IACtB,CAAC;IAED;;;;;;;;;;OAUG;IAEU,AAAN,KAAK,CAAC,UAAU,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