简体中文
您可以使用 files.read() 方法从沙箱文件系统中读取文件。
files.read()
import { Sandbox } from '@e2b/code-interpreter' const sandbox = await Sandbox.create() const fileContent = await sandbox.files.read('/path/to/file')
您可以使用 files.write() 方法将单个文件写入沙箱文件系统。
files.write()
import { Sandbox } from '@e2b/code-interpreter' const sandbox = await Sandbox.create() await sandbox.files.write('/path/to/file', 'file content')
您也可以使用 files.write() 方法将多个文件写入沙箱文件系统。
import { Sandbox } from '@e2b/code-interpreter' const sandbox = await Sandbox.create() await sandbox.files.write([ { path: '/path/to/a', data: 'file content' }, { path: '/another/path/to/b', data: 'file content' } ])