SandboxFS 沙箱文件系统接口
| 30 | |
| 31 | // SandboxFS 沙箱文件系统接口 |
| 32 | type SandboxFS interface { |
| 33 | // Resolve 解析路径为绝对路径 |
| 34 | Resolve(path string) string |
| 35 | |
| 36 | // IsInside 检查路径是否在沙箱内 |
| 37 | IsInside(path string) bool |
| 38 | |
| 39 | // Read 读取文件内容 |
| 40 | Read(ctx context.Context, path string) (string, error) |
| 41 | |
| 42 | // Write 写入文件内容 |
| 43 | Write(ctx context.Context, path string, content string) error |
| 44 | |
| 45 | // Temp 生成临时文件路径 |
| 46 | Temp(name string) string |
| 47 | |
| 48 | // Stat 获取文件状态 |
| 49 | Stat(ctx context.Context, path string) (FileInfo, error) |
| 50 | |
| 51 | // Glob 文件匹配 |
| 52 | Glob(ctx context.Context, pattern string, opts *GlobOptions) ([]string, error) |
| 53 | } |
| 54 | |
| 55 | // FileInfo 文件信息 |
| 56 | type FileInfo struct { |
no outgoing calls
no test coverage detected