Quick Start Guide
Get up and running with ComputeSDK quickly.
Learn how to use ComputeSDK in your application.
Initialize the Client
First, create a new ComputeSDK client:
import { ComputeClient } from 'computesdk';
const computeClient = new ComputeClient();
const compute = await computeClient.create();
Running Commands
Execute any shell command in the secure environment:
// Simple command
const result = await compute.exec('echo "Hello World"');
console.log(result); // Output: Hello World
// Run multiple commands
const result = await compute.exec('pwd && ls -la');
// Install packages
const result = await compute.exec('npm install express');
// Run Python scripts
const result = await compute.exec('python3 -c "print(\'Hello from Python!\')"');
Watch Files
Set up a file watcher:
const watcher = compute.watchFiles({
path: '/home/project',
includeContent: true
});
watcher.onChanged((data) => {
console.log('File changed:', data);
});