14 |
Not Found
15 |
Could not find requested resource
16 |
17 | Return Home
18 |
19 |
20 | )
21 | }
22 |
--------------------------------------------------------------------------------
/apps/web/src/app/opengraph-image.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/e2b-dev/E2B/27e292eedcf04b52b88f5729079c2eb02ae0bc9f/apps/web/src/app/opengraph-image.png
--------------------------------------------------------------------------------
/apps/web/src/app/robots.ts:
--------------------------------------------------------------------------------
1 | import { MetadataRoute } from 'next'
2 |
3 | export default function robots(): MetadataRoute.Robots {
4 | return {
5 | rules: {
6 | userAgent: '*',
7 | allow: '/',
8 | },
9 | sitemap: 'https://e2b.dev/sitemap.xml',
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/apps/web/src/app/twitter-image.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/e2b-dev/E2B/27e292eedcf04b52b88f5729079c2eb02ae0bc9f/apps/web/src/app/twitter-image.png
--------------------------------------------------------------------------------
/apps/web/src/code/js/agents/start_process.js:
--------------------------------------------------------------------------------
1 | import { Sandbox } from 'e2b'
2 |
3 | // 1. Start the playground sandbox
4 | const sandbox = await Sandbox.create({
5 | // You can pass your own sandbox template id
6 | template: 'base',
7 | apiKey: process.env.E2B_API_KEY,
8 | })
9 |
10 | // 2. Start the shell commdand
11 | let proc = await sandbox.process.start({
12 | // $HighlightLine
13 | // Print names of all running processes
14 | cmd: 'ps aux | tr -s \' \' | cut -d \' \' -f 11', // $HighlightLine
15 | // Stream stdout and stderr
16 | onStderr: (data) => console.log(data.line), // $HighlightLine
17 | onStdout: (data) => console.log(data.line), // $HighlightLine
18 | }) // $HighlightLine
19 |
20 | // 3. Wait for the process to finish
21 | await proc.wait()
22 |
23 | // 4. Or you can access output after the process has finished
24 | const output = proc.output
25 |
26 | await sandbox.close()
27 |
--------------------------------------------------------------------------------
/apps/web/src/code/js/api_key/api_key.js:
--------------------------------------------------------------------------------
1 | import { Sandbox } from 'e2b'
2 |
3 | const sandbox = await Sandbox.create({ apiKey: 'YOUR_API_KEY' })
4 | await sandbox.close()
5 |
--------------------------------------------------------------------------------
/apps/web/src/code/js/basics/download_file.js:
--------------------------------------------------------------------------------
1 | import { Sandbox } from 'e2b'
2 | import fs from 'node:fs'
3 |
4 | const sandbox = await Sandbox.create({ template: 'base' })
5 |
6 | const buffer = await sandbox.downloadFile('path/to/remote/file/inside/sandbox', 'buffer') // $HighlightLine
7 | // Save file to local filesystem
8 | fs.writeFileSync('path/to/local/file', buffer)
9 |
10 | await sandbox.close()
11 |
--------------------------------------------------------------------------------
/apps/web/src/code/js/basics/fs_ls.js:
--------------------------------------------------------------------------------
1 | import { Sandbox } from 'e2b'
2 |
3 | const sandbox = await Sandbox.create({
4 | template: 'base',
5 | })
6 |
7 | const dirContent = await sandbox.filesystem.list('/') // $HighlightLine
8 | dirContent.forEach((item) => {
9 | console.log(item.name)
10 | })
11 |
12 | await sandbox.close()
13 |
--------------------------------------------------------------------------------
/apps/web/src/code/js/basics/fs_mkdir.js:
--------------------------------------------------------------------------------
1 | import { Sandbox } from 'e2b'
2 |
3 | const sandbox = await Sandbox.create({ template: 'base' })
4 |
5 | // Create a new directory '/dir'
6 | await sandbox.filesystem.makeDir('/dir') // $HighlightLine
7 |
8 | await sandbox.close()
9 |
--------------------------------------------------------------------------------
/apps/web/src/code/js/basics/fs_read.js:
--------------------------------------------------------------------------------
1 | import { Sandbox } from 'e2b'
2 |
3 | const sandbox = await Sandbox.create({ template: 'base' })
4 |
5 | const fileContent = await sandbox.filesystem.read('/etc/hosts') // $HighlightLine
6 | console.log(fileContent)
7 |
8 | await sandbox.close()
9 |
--------------------------------------------------------------------------------
/apps/web/src/code/js/basics/fs_read_bytes.js:
--------------------------------------------------------------------------------
1 | import fs from 'fs'
2 | import { Sandbox } from 'e2b'
3 |
4 | const sandbox = await Sandbox.create({ template: 'base' })
5 |
6 | // File bytes will read file's content as bytes
7 | // `fileBytes` as a Uint8Array
8 | const fileBytes = await sandbox.filesystem.readBytes('/etc/hosts') // $HighlightLine
9 |
10 | // The output will look similar to this:
11 | //