Quickstart
Upload Files
Upload files from your local machine into a Vibengine sandbox
Upload Files
You can upload files from your local machine or from URLs into a Vibengine sandbox.
Upload from Your Application
import { Sandbox } from 'vibengine'
import fs from 'fs'
const sandbox = await Sandbox.create()
// Upload a string as a file
await sandbox.files.write('/home/user/config.json', JSON.stringify({ key: 'value' }))
// Upload binary content
const buffer = fs.readFileSync('./local-file.png')
await sandbox.files.write('/home/user/image.png', buffer)
await sandbox.kill()from vibengine import Sandbox
import json
sandbox = Sandbox()
# Upload a string as a file
sandbox.files.write('/home/user/config.json', json.dumps({'key': 'value'}))
# Upload binary content
with open('./local-file.png', 'rb') as f:
sandbox.files.write('/home/user/image.png', f.read())
sandbox.kill()Download Files from URLs
Use commands inside the sandbox to download files from the internet:
const sandbox = await Sandbox.create()
// Download a file using curl
await sandbox.commands.run('curl -o /home/user/data.csv https://example.com/data.csv')
// Download using wget
await sandbox.commands.run('wget -P /home/user/ https://example.com/archive.zip')
// Verify the download
const result = await sandbox.commands.run('ls -la /home/user/')
console.log(result.stdout)sandbox = Sandbox()
# Download a file using curl
sandbox.commands.run('curl -o /home/user/data.csv https://example.com/data.csv')
# Download using wget
sandbox.commands.run('wget -P /home/user/ https://example.com/archive.zip')
# Verify the download
result = sandbox.commands.run('ls -la /home/user/')
print(result.stdout)Read Files from the Sandbox
// Read text file
const content = await sandbox.files.read('/home/user/output.txt')
console.log(content)
// List files in a directory
const files = await sandbox.files.list('/home/user')
for (const file of files) {
console.log(`${file.name} - ${file.type}`)
}# Read text file
content = sandbox.files.read('/home/user/output.txt')
print(content)
# List files in a directory
files = sandbox.files.list('/home/user')
for f in files:
print(f"{f.name} - {f.type}")Sandbox filesystems are ephemeral by default. Files are lost when the sandbox is shut down. For persistent storage, see Persistence.