@@ -83,7 +83,7 @@ export interface WatchOpts extends FilesystemRequestOpts {
83
83
/**
84
84
* Timeout for the watch operation in **milliseconds**.
85
85
* You can pass `0` to disable the timeout.
86
- *
86
+ *
87
87
* @default 60_000 // 60 seconds
88
88
*/
89
89
timeoutMs ?: number
@@ -111,13 +111,13 @@ export class Filesystem {
111
111
112
112
/**
113
113
* Read file content as a `string`.
114
- *
114
+ *
115
115
* You can pass `text`, `bytes`, `blob`, or `stream` to `opts.format` to change the return type.
116
- *
116
+ *
117
117
* @param path path to the file.
118
118
* @param opts connection options.
119
119
* @param [opts.format] format of the file content—`text` by default.
120
- *
120
+ *
121
121
* @returns file content as string
122
122
*/
123
123
async read (
@@ -126,13 +126,13 @@ export class Filesystem {
126
126
) : Promise < string >
127
127
/**
128
128
* Read file content as a `Uint8Array`.
129
- *
129
+ *
130
130
* You can pass `text`, `bytes`, `blob`, or `stream` to `opts.format` to change the return type.
131
- *
131
+ *
132
132
* @param path path to the file.
133
133
* @param opts connection options.
134
134
* @param [opts.format] format of the file content—`bytes`.
135
- *
135
+ *
136
136
* @returns file content as `Uint8Array`
137
137
*/
138
138
async read (
@@ -141,13 +141,13 @@ export class Filesystem {
141
141
) : Promise < Uint8Array >
142
142
/**
143
143
* Read file content as a `Blob`.
144
- *
144
+ *
145
145
* You can pass `text`, `bytes`, `blob`, or `stream` to `opts.format` to change the return type.
146
- *
146
+ *
147
147
* @param path path to the file.
148
148
* @param opts connection options.
149
149
* @param [opts.format] format of the file content—`blob`.
150
- *
150
+ *
151
151
* @returns file content as `Blob`
152
152
*/
153
153
async read (
@@ -156,13 +156,13 @@ export class Filesystem {
156
156
) : Promise < Blob >
157
157
/**
158
158
* Read file content as a `ReadableStream`.
159
- *
159
+ *
160
160
* You can pass `text`, `bytes`, `blob`, or `stream` to `opts.format` to change the return type.
161
- *
161
+ *
162
162
* @param path path to the file.
163
163
* @param opts connection options.
164
164
* @param [opts.format] format of the file content—`stream`.
165
- *
165
+ *
166
166
* @returns file content as `ReadableStream`
167
167
*/
168
168
async read (
@@ -207,18 +207,18 @@ export class Filesystem {
207
207
208
208
/**
209
209
* Write content to a file.
210
- *
211
- *
210
+ *
211
+ *
212
212
* Writing to a file that doesn't exist creates the file.
213
- *
213
+ *
214
214
* Writing to a file that already exists overwrites the file.
215
- *
215
+ *
216
216
* Writing to a file at path that doesn't exist creates the necessary directories.
217
217
*
218
218
* @param path path to file.
219
219
* @param data data to write to the file. Data can be a string, `ArrayBuffer`, `Blob`, or `ReadableStream`.
220
220
* @param opts connection options.
221
- *
221
+ *
222
222
* @returns information about the written file
223
223
*/
224
224
async write (
@@ -243,7 +243,10 @@ export class Filesystem {
243
243
return fd
244
244
} ,
245
245
body : { } ,
246
- signal : this . connectionConfig . getSignal ( opts ?. requestTimeoutMs ) ,
246
+ headers : {
247
+ 'Content-Type' : 'multipart/form-data' ,
248
+ 'Bun-Content-Type' : 'temporary-fix' , // https://github.com/oven-sh/bun/issues/14988
249
+ } ,
247
250
} )
248
251
249
252
const err = await handleEnvdApiError ( res )
@@ -264,7 +267,7 @@ export class Filesystem {
264
267
*
265
268
* @param path path to the directory.
266
269
* @param opts connection options.
267
- *
270
+ *
268
271
* @returns list of entries in the sandbox filesystem directory.
269
272
*/
270
273
async list ( path : string , opts ?: FilesystemRequestOpts ) : Promise < EntryInfo [ ] > {
@@ -302,7 +305,7 @@ export class Filesystem {
302
305
*
303
306
* @param path path to a new directory. For example '/dirA/dirB' when creating 'dirB'.
304
307
* @param opts connection options.
305
- *
308
+ *
306
309
* @returns `true` if the directory was created, `false` if it already exists.
307
310
*/
308
311
async makeDir ( path : string , opts ?: FilesystemRequestOpts ) : Promise < boolean > {
@@ -333,7 +336,7 @@ export class Filesystem {
333
336
* @param oldPath path to the file or directory to rename.
334
337
* @param newPath new path for the file or directory.
335
338
* @param opts connection options.
336
- *
339
+ *
337
340
* @returns information about renamed file or directory.
338
341
*/
339
342
async rename (
@@ -370,7 +373,7 @@ export class Filesystem {
370
373
371
374
/**
372
375
* Remove a file or directory.
373
- *
376
+ *
374
377
* @param path path to a file or directory.
375
378
* @param opts connection options.
376
379
*/
@@ -393,7 +396,7 @@ export class Filesystem {
393
396
*
394
397
* @param path path to a file or a directory
395
398
* @param opts connection options.
396
- *
399
+ *
397
400
* @returns `true` if the file or directory exists, `false` otherwise
398
401
*/
399
402
async exists ( path : string , opts ?: FilesystemRequestOpts ) : Promise < boolean > {
@@ -424,13 +427,13 @@ export class Filesystem {
424
427
* @param path path to directory to watch.
425
428
* @param onEvent callback to call when an event in the directory occurs.
426
429
* @param opts connection options.
427
- *
430
+ *
428
431
* @returns `WatchHandle` object for stopping watching directory.
429
432
*/
430
433
async watchDir (
431
434
path : string ,
432
435
onEvent : ( event : FilesystemEvent ) => void | Promise < void > ,
433
- opts ?: WatchOpts ,
436
+ opts ?: WatchOpts
434
437
) : Promise < WatchHandle > {
435
438
const requestTimeoutMs =
436
439
opts ?. requestTimeoutMs ?? this . connectionConfig . requestTimeoutMs
@@ -439,8 +442,8 @@ export class Filesystem {
439
442
440
443
const reqTimeout = requestTimeoutMs
441
444
? setTimeout ( ( ) => {
442
- controller . abort ( )
443
- } , requestTimeoutMs )
445
+ controller . abort ( )
446
+ } , requestTimeoutMs )
444
447
: undefined
445
448
446
449
const events = this . rpc . watchDir (
0 commit comments