Skip to main content

VolumeFileType

File type enum.

Enumeration Members

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

Create a local Volume instance with no API call.
Parameters
Returns
Volume

Properties

Methods

exists()

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
Returns
Promise<boolean> true if the path exists, false otherwise.

getInfo()

Get information about a file or directory.
Parameters
Returns
Promise<VolumeEntryStat> information about the entry.

list()

List directory contents.
Parameters
Returns
Promise<VolumeEntryStat[]> list of entries in the directory.

makeDir()

Create a directory.
Parameters
Returns
Promise<VolumeEntryStat>

readFile()

Call Signature
Read file content as a string. You can pass text, bytes, blob, or stream to opts.format to change the return type.
Parameters
Returns
Promise<string> file content as string
Call Signature
Read file content as a Uint8Array. You can pass text, bytes, blob, or stream to opts.format to change the return type.
Parameters
Returns
Promise<Uint8Array<ArrayBufferLike>> file content as Uint8Array
Call Signature
Read file content as a Blob. You can pass text, bytes, blob, or stream to opts.format to change the return type.
Parameters
Returns
Promise<Blob> file content as Blob
Call Signature
Read file content as a ReadableStream. You can pass text, bytes, blob, or stream to opts.format to change the return type.
Parameters
Returns
Promise<ReadableStream<Uint8Array<ArrayBufferLike>>> file content as ReadableStream

remove()

Remove a file or directory.
Parameters
Returns
Promise<void>

updateMetadata()

Update file or directory metadata.
Parameters
Returns
Promise<VolumeEntryStat> updated entry information.

writeFile()

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
Returns
Promise<VolumeEntryStat> information about the written file

connect()

Connect to an existing volume by ID.
Parameters
Returns
Promise<Volume> Volume instance.

create()

Create a new volume.
Parameters
Returns
Promise<Volume> new Volume instance.

destroy()

Destroy a volume.
Parameters
Returns
Promise<boolean>

getInfo()

Get volume information.
Parameters
Returns
Promise<VolumeAndToken> volume information.

list()

List all volumes.
Parameters
Returns
Promise<VolumeInfo[]> list of volume information.

VolumeConnectionConfig

Constructors

Parameters
Returns
VolumeConnectionConfig

Properties

Methods

getSignal()

Parameters
Returns
undefined | AbortSignal

Interfaces

VolumeApiOpts

Properties

domain?

Domain to use for the volume API.
Default
E2B_DOMAIN // environment variable or e2b.app

headers?

Additional headers to send with the request.

logger?

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

proxy?

Proxy URL to use for requests.
Example

requestTimeoutMs?

Timeout for requests to the API in milliseconds.
Default

signal?

An optional AbortSignal that can be used to cancel the in-flight request. When the signal is aborted, the underlying fetch is aborted and the returned promise rejects with an AbortError.

token?

E2B API key to use for authentication.
Default

Type Aliases

VolumeAndToken

Information about a volume and its auth token.

Type declaration


VolumeEntryStat

Volume entry stat with dates converted to Date objects.

Type declaration


VolumeInfo

Information about a volume.

Type declaration


VolumeMetadataOptions

Options for updating file metadata.

Type declaration


VolumeWriteOptions

Options for file and directory operations.

Type declaration