Skip to main content

Module file

Module file 

Source
Expand description

Native file module for high-level filesystem operations.

Exports: file.read_text, file.write_text, file.read_lines, file.append, file.read_bytes, file.write_bytes

All operations go through FileSystemProvider so that sandbox/VFS modes work transparently. The default provider is RealFileSystem.

Policy gated: read ops require FsRead, write ops require FsWrite.

Functionsยง

create_file_module
Create the file module using the default real filesystem.
create_file_module_with_provider
Create a file module that uses the given filesystem provider. The default create_file_module() uses RealFileSystem; callers can substitute a PolicyEnforcedFs or VirtualFileSystem for sandboxing.