Documentation Index
Fetch the complete documentation index at: https://e2b.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
You can get information about a file or directory in a volume using the getInfo() / get_info() method.
import { Volume } from 'e2b'
const volume = await Volume.create('my-volume')
// Create a new file
await volume.writeFile('/test_file.txt', 'Hello, world!')
// Get information about the file
const info = await volume.getInfo('/test_file.txt')
console.log(info)
// {
// name: 'test_file.txt',
// type: 'file',
// path: '/test_file.txt',
// size: 13,
// mode: 0o644,
// uid: 0,
// gid: 0,
// atime: 2025-05-26T12:00:00.000Z,
// mtime: 2025-05-26T12:00:00.000Z,
// ctime: 2025-05-26T12:00:00.000Z,
// }
import { Volume } from 'e2b'
const volume = await Volume.create('my-volume')
// Create a new directory
await volume.makeDir('/test_dir')
// Get information about the directory
const info = await volume.getInfo('/test_dir')
console.log(info)
// {
// name: 'test_dir',
// type: 'directory',
// path: '/test_dir',
// size: 0,
// mode: 0o755,
// uid: 0,
// gid: 0,
// atime: 2025-05-26T12:00:00.000Z,
// mtime: 2025-05-26T12:00:00.000Z,
// ctime: 2025-05-26T12:00:00.000Z,
// }
Checking if a path exists
You can check whether a file or directory exists in a volume using the exists() method.
import { Volume } from 'e2b'
const volume = await Volume.create('my-volume')
const fileExists = await volume.exists('/test_file.txt')
console.log(fileExists) // true or false
You can update file or directory metadata such as user ID, group ID, and permissions mode using the updateMetadata() / update_metadata() method.
import { Volume } from 'e2b'
const volume = await Volume.create('my-volume')
await volume.writeFile('/test_file.txt', 'Hello, world!')
const updated = await volume.updateMetadata('/test_file.txt', { uid: 1000, gid: 1000, mode: 0o600 })
console.log(updated)
// {
// name: 'test_file.txt',
// type: 'file',
// path: '/test_file.txt',
// size: 13,
// mode: 0o600,
// uid: 1000,
// gid: 1000,
// ...
// }