Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions packages/projects-docs/pages/sdk/filesystem.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,25 @@ const content = await client.fs.readFile("./hello.bin");
console.log(content);
```

### Batch write files

If you need to write a lot of files, you can batch write instead. This will compress the files into a single file, upload that file and then uncompress them on the Sandbox. If the path of files match an existing file, it will be overridden.

```ts
await client.fs.batchWrite([
{
// The path to write the contents to (relative to workspace)
path: "src/index.html",
content: "hello world",
},
{
path: "src/foo.bin",
// You can also write binary files
content: new Uint8Array([1, 2, 3])
},
]);
```

### Uploading & Downloading Files

Uploading and downloading files can be done using the same methods.
Expand Down