LelantosLelantos
Filesystem

Upload Files

Upload files to sandbox filesystem.

Overview

Upload files to a running sandbox to provide input data, scripts, configuration files, or any other content your workload needs. Files are written to the sandbox's 20 GB disk.

Uploading a Text File

await sandbox.uploadFile(
  "/home/user/hello.txt",
  "Hello from Lelantos!"
);
curl -X POST "https://SANDBOX_ID.lelantos.ai/files" \
  -H "Content-Type: multipart/form-data" \
  -F "path=/home/user/hello.txt" \
  -F "file=@hello.txt"

Uploading Binary Files

The SDK accepts both strings and Uint8Array / Buffer content:

import { readFileSync } from "fs";

// Upload a binary file (e.g., an image)
const imageBuffer = readFileSync("./chart.png");
await sandbox.uploadFile("/home/user/chart.png", imageBuffer);

// Upload a JSON file
const config = JSON.stringify({ model: "gpt-4", temperature: 0.7 });
await sandbox.uploadFile("/home/user/config.json", config);

Uploading Multiple Files

Upload several files in sequence or in parallel:

// Sequential uploads
await sandbox.uploadFile("/home/user/data/input.csv", csvData);
await sandbox.uploadFile("/home/user/scripts/process.py", pythonScript);
await sandbox.uploadFile("/home/user/config.yaml", yamlConfig);

// Parallel uploads
await Promise.all([
  sandbox.uploadFile("/home/user/file1.txt", content1),
  sandbox.uploadFile("/home/user/file2.txt", content2),
  sandbox.uploadFile("/home/user/file3.txt", content3),
]);

Creating Directories

Directories are created automatically when you upload a file to a path that does not exist yet. You can also create directories explicitly via commands:

await sandbox.commands.run("mkdir -p /home/user/data/output");

The maximum disk space available in a sandbox is 20 GB. If you need to work with large datasets, consider downloading them directly inside the sandbox using curl or wget instead of uploading through the API.

On this page