modal
    Preparing search index...

    Class Sandbox

    Sandboxes are secure, isolated containers in Modal that boot in seconds.

    Index

    Properties

    sandboxId: string
    stderr: ModalReadStream<string>
    stdin: ModalWriteStream<string>
    stdout: ModalReadStream<string>

    Methods

    • Get tags (key-value pairs) currently attached to this Sandbox from the server.

      Returns Promise<Record<string, string>>

    • Check if the Sandbox has finished running.

      Returns null if the Sandbox is still running, else returns the exit code.

      Returns Promise<null | number>

    • Set tags (key-value pairs) on the Sandbox. Tags can be used to filter results in Sandbox.list.

      Parameters

      • tags: Record<string, string>

      Returns Promise<void>

    • Snapshot the filesystem of the Sandbox.

      Returns an Image object which can be used to spawn a new Sandbox with the same filesystem.

      Parameters

      • timeout: number = 55000

        Timeout for the snapshot operation in milliseconds

      Returns Promise<Image>

      Promise that resolves to an Image

    • Get Tunnel metadata for the Sandbox.

      Raises SandboxTimeoutError if the tunnels are not available after the timeout.

      Parameters

      • timeout: number = 50000

      Returns Promise<Record<number, Tunnel>>

      A dictionary of Tunnel objects which are keyed by the container port.