Expand description
Native file module for high-level filesystem operations.
Exports: file.read_text, file.write_text, file.read_lines, file.append
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.
Phase 2c migration: ported to the typed marshal layer.
file.read_bytes / file.write_bytes are deferred until the
Array<number> marshal extension (FromSlot/ToSlot for typed-array
heap pointers) lands. Tracked alongside the parser-module deferral
list. The functions previously here read/wrote byte arrays via
the deleted as_any_array().to_generic() tag_bits dispatch —
strict-typed answer is Arc<TypedBuffer<f64>> typed args + ToSlot
projection of ConcreteReturn::ArrayF64 to a heap-allocated
TypedArray slot.
Functions§
- create_
file_ module - Create the
filemodule 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()usesRealFileSystem; callers can substitute aPolicyEnforcedFsorVirtualFileSystemfor sandboxing.