Skip to main content
You can get information about a file or directory in a volume using the getEntryInfo() / get_entry_info() method.

Getting information about a file

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.getEntryInfo('/test_file.txt')

console.log(info)
// {
//   name: 'test_file.txt',
//   type: 'file',
//   path: '/test_file.txt',
//   size: 13,
//   mode: 0o644,
//   uid: 0,
//   gid: 0,
//   mtime: 2025-05-26T12:00:00.000Z,
//   ctime: 2025-05-26T12:00:00.000Z,
//   target: null
// }

Getting information about a directory

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.getEntryInfo('/test_dir')

console.log(info)
// {
//   name: 'test_dir',
//   type: 'directory',
//   path: '/test_dir',
//   size: 0,
//   mode: 0o755,
//   uid: 0,
//   gid: 0,
//   mtime: 2025-05-26T12:00:00.000Z,
//   ctime: 2025-05-26T12:00:00.000Z,
//   target: null
// }

Updating metadata

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,
//   ...
// }