Skip to main content

Documentation Index

Fetch the complete documentation index at: https://e2b-automation-sdk-reference-sync.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

VolumeFileType

File type enum.

Enumeration Members

Enumeration MemberValue
DIRECTORY"directory"
FILE"file"
SYMLINK"symlink"
UNKNOWN"unknown"

Classes

Volume

Module for interacting with E2B volumes. Create a Volume instance to interact with a volume by its ID, or use the static methods to manage volumes.

Constructors

new Volume(
   volumeId: string, 
   name: string, 
   token: string, 
   domain?: string, 
   debug?: boolean): Volume
Create a local Volume instance with no API call.
Parameters
ParameterTypeDescription
volumeIdstringvolume ID.
namestringvolume name.
tokenstringvolume auth token.
domain?stringdomain for the volume API.
debug?booleanwhether to use debug mode.
Returns
Volume

Properties

PropertyModifierTypeDescription
debug?readonlybooleanWhether to use debug mode (connects to local volume API server).
domain?readonlystringDomain used for constructing the volume API URL.
namereadonlystringVolume name.
tokenreadonlystringVolume auth token.
volumeIdreadonlystringVolume ID.

Methods

exists()

exists(path: string, opts?: VolumeApiOpts): Promise<boolean>
Check whether a file or directory exists. Uses getInfo under the hood. Returns true if the path exists, false if it does not (404). Other errors are rethrown.
Parameters
ParameterTypeDescription
pathstringpath to the file or directory.
opts?VolumeApiOptsconnection options.
Returns
Promise<boolean> true if the path exists, false otherwise.

getInfo()

getInfo(path: string, opts?: VolumeApiOpts): Promise<VolumeEntryStat>
Get information about a file or directory.
Parameters
ParameterTypeDescription
pathstringpath to the file or directory.
opts?VolumeApiOptsconnection options.
Returns
Promise<VolumeEntryStat> information about the entry.

list()

list(path: string, opts?: VolumeApiOpts & object): Promise<VolumeEntryStat[]>
List directory contents.
Parameters
ParameterTypeDescription
pathstringpath to the directory.
opts?VolumeApiOpts & objectconnection options.
Returns
Promise<VolumeEntryStat[]> list of entries in the directory.

makeDir()

makeDir(path: string, opts?: VolumeMetadataOptions & object & VolumeApiOpts): Promise<VolumeEntryStat>
Create a directory.
Parameters
ParameterTypeDescription
pathstringpath to the directory to create.
opts?VolumeMetadataOptions & object & VolumeApiOptsconnection options.
Returns
Promise<VolumeEntryStat>

readFile()

Call Signature
readFile(path: string, opts?: VolumeApiOpts & object): Promise<string>
Read file content as a string. You can pass text, bytes, blob, or stream to opts.format to change the return type.
Parameters
ParameterTypeDescription
pathstringpath to the file.
opts?VolumeApiOpts & objectconnection options.
Returns
Promise<string> file content as string
Call Signature
readFile(path: string, opts?: VolumeApiOpts & object): Promise<Uint8Array<ArrayBufferLike>>
Read file content as a Uint8Array. You can pass text, bytes, blob, or stream to opts.format to change the return type.
Parameters
ParameterTypeDescription
pathstringpath to the file.
opts?VolumeApiOpts & objectconnection options.
Returns
Promise<Uint8Array<ArrayBufferLike>> file content as Uint8Array
Call Signature
readFile(path: string, opts?: VolumeApiOpts & object): Promise<Blob>
Read file content as a Blob. You can pass text, bytes, blob, or stream to opts.format to change the return type.
Parameters
ParameterTypeDescription
pathstringpath to the file.
opts?VolumeApiOpts & objectconnection options.
Returns
Promise<Blob> file content as Blob
Call Signature
readFile(path: string, opts?: VolumeApiOpts & object): Promise<ReadableStream<Uint8Array<ArrayBufferLike>>>
Read file content as a ReadableStream. You can pass text, bytes, blob, or stream to opts.format to change the return type.
Parameters
ParameterTypeDescription
pathstringpath to the file.
opts?VolumeApiOpts & objectconnection options.
Returns
Promise<ReadableStream<Uint8Array<ArrayBufferLike>>> file content as ReadableStream

remove()

remove(path: string, opts?: VolumeApiOpts): Promise<void>
Remove a file or directory.
Parameters
ParameterTypeDescription
pathstringpath to the file or directory to remove.
opts?VolumeApiOptsconnection options.
Returns
Promise<void>

updateMetadata()

updateMetadata(
   path: string, 
   metadata: VolumeMetadataOptions, 
opts?: VolumeApiOpts): Promise<VolumeEntryStat>
Update file or directory metadata.
Parameters
ParameterTypeDescription
pathstringpath to the file or directory.
metadataVolumeMetadataOptionsmetadata to update (uid, gid, mode).
opts?VolumeApiOptsconnection options.
Returns
Promise<VolumeEntryStat> updated entry information.

writeFile()

writeFile(
   path: string, 
   data: 
  | string
  | ArrayBuffer
  | Blob
  | ReadableStream<Uint8Array<ArrayBufferLike>>, 
opts?: VolumeMetadataOptions & object & VolumeApiOpts): Promise<VolumeEntryStat>
Write content to a file. Writing to a file that doesn’t exist creates the file. Writing to a file that already exists overwrites the file.
Parameters
ParameterTypeDescription
pathstringpath to the file.
data| string | ArrayBuffer | Blob | ReadableStream<Uint8Array<ArrayBufferLike>>data to write to the file. Data can be a string, ArrayBuffer, Blob, or ReadableStream.
opts?VolumeMetadataOptions & object & VolumeApiOptsconnection options.
Returns
Promise<VolumeEntryStat> information about the written file

connect()

static connect(volumeId: string, opts?: ConnectionOpts): Promise<Volume>
Connect to an existing volume by ID.
Parameters
ParameterTypeDescription
volumeIdstringvolume ID.
opts?ConnectionOptsconnection options.
Returns
Promise<Volume> Volume instance.

create()

static create(name: string, opts?: ConnectionOpts): Promise<Volume>
Create a new volume.
Parameters
ParameterTypeDescription
namestringname of the volume.
opts?ConnectionOptsconnection options.
Returns
Promise<Volume> new Volume instance.

destroy()

static destroy(volumeId: string, opts?: ConnectionOpts): Promise<boolean>
Destroy a volume.
Parameters
ParameterTypeDescription
volumeIdstringvolume ID.
opts?ConnectionOptsconnection options.
Returns
Promise<boolean>

getInfo()

static getInfo(volumeId: string, opts?: ConnectionOpts): Promise<VolumeAndToken>
Get volume information.
Parameters
ParameterTypeDescription
volumeIdstringvolume ID.
opts?ConnectionOptsconnection options.
Returns
Promise<VolumeAndToken> volume information.

list()

static list(opts?: ConnectionOpts): Promise<VolumeInfo[]>
List all volumes.
Parameters
ParameterTypeDescription
opts?ConnectionOptsconnection options.
Returns
Promise<VolumeInfo[]> list of volume information.

VolumeConnectionConfig

Constructors

new VolumeConnectionConfig(volume: Volume, opts?: VolumeApiOpts): VolumeConnectionConfig
Parameters
ParameterType
volumeVolume
opts?VolumeApiOpts
Returns
VolumeConnectionConfig

Properties

PropertyModifierType
apiUrlreadonlystring
debugreadonlyboolean
domainreadonlystring
headers?readonlyRecord<string, string>
logger?readonlyLogger
requestTimeoutMs?readonlynumber
token?readonlystring

Methods

getSignal()

getSignal(requestTimeoutMs?: number): undefined | AbortSignal
Parameters
ParameterType
requestTimeoutMs?number
Returns
undefined | AbortSignal

Interfaces

VolumeApiOpts

Properties

domain?

optional domain: string;
Domain to use for the volume API.
Default
E2B_DOMAIN // environment variable or e2b.app

headers?

optional headers: Record<string, string>;
Additional headers to send with the request.

logger?

optional logger: Logger;
Logger to use for logging messages. It can accept any object that implements Logger interface—for example, console.

requestTimeoutMs?

optional requestTimeoutMs: number;
Timeout for requests to the API in milliseconds.
Default
60_000 // 60 seconds

token?

optional token: string;
E2B API key to use for authentication.
Default
E2B_API_KEY // environment variable

Type Aliases

VolumeAndToken

type VolumeAndToken = VolumeInfo & object;
Information about a volume and its auth token.

Type declaration

NameTypeDescription
tokenstringVolume auth token.

VolumeEntryStat

type VolumeEntryStat = Omit<VolumeApiComponents["schemas"]["VolumeEntryStat"], "atime" | "mtime" | "ctime" | "type"> & object;
Volume entry stat with dates converted to Date objects.

Type declaration

NameTypeDescription
atimeDateAccess time as a Date object.
ctimeDateCreation time as a Date object.
mtimeDateModification time as a Date object.
typeVolumeFileTypeFile type.

VolumeInfo

type VolumeInfo = object;
Information about a volume.

Type declaration

NameTypeDescription
namestringVolume name.
volumeIdstringVolume ID.

VolumeMetadataOptions

type VolumeMetadataOptions = object;
Options for updating file metadata.

Type declaration

NameTypeDescription
gid?numberGroup ID of the file or directory.
mode?numberMode of the file or directory.
uid?numberUser ID of the file or directory.

VolumeWriteOptions

type VolumeWriteOptions = VolumeMetadataOptions & object;
Options for file and directory operations.

Type declaration

NameTypeDescription
force?booleanFor makeDir: Create parent directories if they don’t exist. For writeFile: Force overwrite of an existing file.