easysandbox
v2.0.0
Published
Node.js SDK for Novisurf Sandboxes
Downloads
28
Readme
Novisurf Sandbox Node.js SDK
A lightweight Node.js SDK for managing isolated E2B sandboxes via the Novisurf Developer API.
Installation
npm install novisandboxUsage
1. Set Environment Variable
export NOVISURF_API_TOKEN='your_lsk_token_here'2. Basic Example
import { Sandbox } from 'novisandbox';
// Create a new sandbox
const sandbox = await Sandbox.provision('base');
// Run code
const result = await sandbox.run({
code: 'print("Hello World")',
language: 'python'
});
console.log(result.stdout);
// Manage files
await sandbox.writeFile('/app/data.txt', 'Hello Novisurf');
const content = await sandbox.readFile('/app/data.txt');
// Cleanup
await sandbox.kill();API Reference
Sandbox.provision(template = 'base')
Provisions a new sandbox instance.
Sandbox.connect(sandboxId)
Connects to an existing active sandbox instance.
Sandbox.list()
Returns an array of all currently active sandboxIds for the user.
sandbox.run({ code, command, language })
Executes code or terminal commands.
sandbox.writeFile(path, content)
Writes a single file.
sandbox.writeBatch(files)
Writes multiple files: [{ path, content }, ...].
sandbox.readFile(path)
Reads a file's content.
sandbox.listFiles(path)
Lists entries in a directory.
sandbox.deleteFile(path)
Deletes a file or directory.
sandbox.createDirectory(path)
Creates a directory.
sandbox.kill()
Terminates the instance.
