Skip to content

armgit / E2B

Public Imported from GitHub
0

Open-source, secure environment with real-world tools for enterprise-grade agents.

Update docs

Vasek Mlejnskyb3e8ed76250b
diff --git a/apps/web/src/app/(docs)/docs/code-interpreting/create-charts-visualizations/page.mdx b/apps/web/src/app/(docs)/docs/code-interpreting/create-charts-visualizations/page.mdx
index 3300192dd..71495f863 100644
--- a/apps/web/src/app/(docs)/docs/code-interpreting/create-charts-visualizations/page.mdx
+++ b/apps/web/src/app/(docs)/docs/code-interpreting/create-charts-visualizations/page.mdx
@@ -3,7 +3,7 @@ E2B Sandbox allows you to create charts and visualizations by executing Python c
These charts and visualizations can be [static](/docs/code-interpreting/create-charts-visualizations/static-charts) or [interactive](/docs/code-interpreting/create-charts-visualizations/interactive-charts) plots.
-<Note>
+{/* <Note>
Learn more about different types of results that E2B Sandbox can return [(TODO: link)here](/docs/code-interpreting/results).
-</Note>
+</Note> */}
diff --git a/apps/web/src/app/(docs)/docs/code-interpreting/supported-languages/page.mdx b/apps/web/src/app/(docs)/docs/code-interpreting/supported-languages/page.mdx
index 41de57c46..e587ffd7c 100644
--- a/apps/web/src/app/(docs)/docs/code-interpreting/supported-languages/page.mdx
+++ b/apps/web/src/app/(docs)/docs/code-interpreting/supported-languages/page.mdx
@@ -10,5 +10,5 @@ Out of the box E2B Sandbox supports:
- [Bash](/docs/code-interpreting/analyze-data/supported-languages/bash)
<Note>
-You can use any custom language runtime by creating a [(todo: link)custom sandbox template]().
+You can use any custom language runtime by creating a [custom sandbox template](/docs/sandbox-template).
</Note>
diff --git a/apps/web/src/app/(docs)/docs/filesystem/download/page.mdx b/apps/web/src/app/(docs)/docs/filesystem/download/page.mdx
new file mode 100644
index 000000000..4ada9102b
--- /dev/null
+++ b/apps/web/src/app/(docs)/docs/filesystem/download/page.mdx
@@ -0,0 +1,28 @@
+# Download data from sandbox
+
+You can download data from the sandbox using the `files.read()` method.
+
+<CodeGroup>
+```js
+import fs from 'fs'
+import { Sandbox } from '@e2b/code-interpreter'
+
+const sandbox = await Sandbox.create()
+
+// Read file from sandbox
+const content = await sandbox.files.read('/path/in/sandbox')
+// Write file to local filesystem
+fs.writeFileSync('/local/path', content)
+```
+```python
+from e2b_code_interpreter import Sandbox
+
+sandbox = Sandbox()
+
+# Read file from sandbox
+content = sandbox.files.read('/path/in/sandbox')
+# Write file to local filesystem
+with open('/local/path', 'wb') as file:
+ file.write(content)
+```
+</CodeGroup>
diff --git a/apps/web/src/app/(docs)/docs/filesystem/page.mdx b/apps/web/src/app/(docs)/docs/filesystem/page.mdx
new file mode 100644
index 000000000..06e038672
--- /dev/null
+++ b/apps/web/src/app/(docs)/docs/filesystem/page.mdx
@@ -0,0 +1,10 @@
+# Filesystem
+
+Each E2B Sandbox has its own isolated filesystem with 5GB of disk space.
+
+With E2B SDK you can:
+- [Read and write files to the sandbox.](/docs/filesystem/read-write)
+- [Watch directory for changes.](/docs/filesystem/watch)
+- [Upload data to the sandbox.](/docs/filesystem/upload)
+- [Download data from the sandbox.](/docs/filesystem/download)
+
diff --git a/apps/web/src/app/(docs)/docs/filesystem/read-write/page.mdx b/apps/web/src/app/(docs)/docs/filesystem/read-write/page.mdx
new file mode 100644
index 000000000..c61c586c0
--- /dev/null
+++ b/apps/web/src/app/(docs)/docs/filesystem/read-write/page.mdx
@@ -0,0 +1,37 @@
+# Read & write files
+
+## Reading files
+
+You can read files from the sandbox filesystem using the `files.reado()` method.
+
+<CodeGroup>
+```js
+import { Sandbox } from '@e2b/code-interpreter'
+const sandbox = await Sandbox.create()
+const fileContent = await sandbox.files.read('/path/to/file')
+```
+```python
+from e2b_code_interpreter import Sandbox
+
+sandbox = Sandbox()
+file_content = sandbox.files.read('/path/to/file')
+```
+</CodeGroup>
+
+## Writing files
+
+You can write files to the sandbox filesystem using the `files.write()` method.
+
+<CodeGroup>
+```js
+import { Sandbox } from '@e2b/code-interpreter'
+const sandbox = await Sandbox.create()
+await sandbox.files.write('/path/to/file', 'file content')
+```
+```python
+from e2b_code_interpreter import Sandbox
+
+sandbox = Sandbox()
+await sandbox.files.write('/path/to/file', 'file content')
+```
+</CodeGroup>
diff --git a/apps/web/src/app/(docs)/docs/filesystem/upload/page.mdx b/apps/web/src/app/(docs)/docs/filesystem/upload/page.mdx
new file mode 100644
index 000000000..1b16f2668
--- /dev/null
+++ b/apps/web/src/app/(docs)/docs/filesystem/upload/page.mdx
@@ -0,0 +1,27 @@
+# Upload data to sandbox
+
+You can upload data to the sandbox using the `files.write()` method.
+
+<CodeGroup>
+```js
+import fs from 'fs'
+import { Sandbox } from '@e2b/code-interpreter'
+
+const sandbox = await Sandbox.create()
+
+// Read file from local filesystem
+const content = fs.readFileSync('/local/path')
+// Upload file to sandbox
+await sandbox.files.write('/path/in/sandbox', content)
+```
+```python
+from e2b_code_interpreter import Sandbox
+
+sandbox = Sandbox()
+
+# Read file from local filesystem
+with open("path/to/local/file", "rb") as file:
+ # Upload file to sandbox
+ sandbox.files.write("/path/in/sandbox", file)
+```
+</CodeGroup>
diff --git a/apps/web/src/app/(docs)/docs/filesystem/watch/page.mdx b/apps/web/src/app/(docs)/docs/filesystem/watch/page.mdx
new file mode 100644
index 000000000..48bd3e346
--- /dev/null
+++ b/apps/web/src/app/(docs)/docs/filesystem/watch/page.mdx
@@ -0,0 +1,41 @@
+# Watch sandbox directory for changes
+
+You can watch a directory for changes using the `files.watchDir()` method in JavaScript and `files.watch_dir()` method in Python.
+
+<CodeGroup>
+```js
+import { Sandbox, FilesystemEventType } from '@e2b/code-interpreter'
+
+const sandbox = await Sandbox.create()
+const dirname = '/home/user'
+
+// Start watching directory for changes
+const handle = await sandbox.files.watchDir(dirname, async (event) => { // $HighlightLine
+ console.log(event) // $HighlightLine
+ if (event.type === FilesystemEventType.WRITE) { // $HighlightLine
+ console.log(`wrote to file ${event.name}`) // $HighlightLine
+ } // $HighlightLine
+}) // $HighlightLine
+
+// Trigger file write event
+await sandbox.files.write(`${dirname}/my-file`, 'hello')
+```
+```python
+from e2b_code_interpreter import Sandbox
+
+sandbox = Sandbox()
+dirname = '/home/user'
+
+# Watch directory for changes
+handle = sandbox.files.watch_dir(dirname) # $HighlightLine
+# Trigger file write event
+sandbox.files.write(f"{dirname}/my-file", "hello")
+
+# Retrieve the latest new events since the last `get_new_events()` call
+events = handle.get_new_events() # $HighlightLine
+for event in events: # $HighlightLine
+ print(event) # $HighlightLine
+ if event.type == FilesystemEventType.Write: # $HighlightLine
+ print(f"wrote to file {event.name}") # $HighlightLine
+```
+</CodeGroup>
diff --git a/apps/web/src/app/(docs)/docs/quickstart/upload-download-files/page.mdx b/apps/web/src/app/(docs)/docs/quickstart/upload-download-files/page.mdx
index ca1d90ffc..291976479 100644
--- a/apps/web/src/app/(docs)/docs/quickstart/upload-download-files/page.mdx
+++ b/apps/web/src/app/(docs)/docs/quickstart/upload-download-files/page.mdx
@@ -2,7 +2,7 @@
E2B Sandbox allows you to upload and downloads file to and from the Sandbox.
-An alternative way to get your data to the sandbox is to create a [(TODO: link)custom sandbox template]().
+An alternative way to get your data to the sandbox is to create a [custom sandbox template](/docs/sandbox-template).
## Upload file
diff --git a/apps/web/src/components/Layout.tsx b/apps/web/src/components/Layout.tsx
index 1af32d527..a1ce0c895 100644
--- a/apps/web/src/components/Layout.tsx
+++ b/apps/web/src/components/Layout.tsx
@@ -22,7 +22,7 @@ export function Layout({
return (
<SectionProvider sections={relativePathname ? allSections[relativePathname] ?? [] : []}>
- <div className={clsx('h-full w-full', { 'lg:ml-[var(--sidebar-nav-width)]': isDocs })}>
+ <div className={clsx('h-[100vh] w-full', { 'lg:ml-[var(--sidebar-nav-width)]': isDocs })}>
{!isDashboard && (
<motion.header
layoutScroll
@@ -51,7 +51,6 @@ export function Layout({
className="
relative
flex
- h-full
flex-col
px-4
pt-14
diff --git a/apps/web/src/components/Navigation/routes.tsx b/apps/web/src/components/Navigation/routes.tsx
index b5999841d..7b2f7dafb 100644
--- a/apps/web/src/components/Navigation/routes.tsx
+++ b/apps/web/src/components/Navigation/routes.tsx
@@ -342,26 +342,26 @@ export const routes: NavGroup[] = [
]
},
{
- title: '* Filesystem',
+ title: 'Filesystem',
items: [
{
- title: '* Overview',
- href: '/docs/filesystem/overview',
+ title: 'Overview',
+ href: '/docs/filesystem',
},
{
- title: '* Read & write',
+ title: 'Read & write',
href: '/docs/filesystem/read-write',
},
{
- title: '* Watch directory for changes',
+ title: 'Watch directory for changes',
href: '/docs/filesystem/watch',
},
{
- title: '* Upload data',
+ title: 'Upload data',
href: '/docs/filesystem/upload',
},
{
- title: '* Download data',
+ title: 'Download data',
href: '/docs/filesystem/download',
},
]