Copy
import fs from 'fs'
import { Sandbox } from 'ppio-sandbox/code-interpreter'
const sandbox = await Sandbox.create()
// 在沙箱内创建一个文件用于测试
const filePathInSandbox = '/tmp/test-file'
await sandbox.files.write(filePathInSandbox, "test-file-content")
// 从沙箱读取文件内容
const content = await sandbox.files.read(filePathInSandbox)
// 将文件写入本地文件系统
const localFilePath = './local-test-file'
fs.writeFileSync(localFilePath, content)
await sandbox.kill()