Struct
FilesystemBuilder
pub struct FilesystemBuilder { /* private fields */ }Builder for Filesystem.
Methods
#pub fn allow_hard_links(&mut self, allow: bool) -> &mut Self
Permits regular files that have other names (hard links). By default
such a file is refused (PATH_DENIED) by every operation that reads,
writes, copies or measures its contents. Its other names may lie
outside every root or under a deny rule and no platform can tell the
location re-check which. Enable only when the roots hold multiply
linked files by design (a pnpm store, a local git clone) and nobody
untrusted can create links in them. Listing, removing and renaming a
link’s name are unaffected either way.
#pub fn max_file_size(&mut self, bytes: u64) -> &mut Self
Caps the bytes read_file returns and write_file accepts
(FsError::TooLarge beyond it). A whole file travels in one IPC
message and is held in memory by both processes. The cap bounds what
one renderer call can cost until file transfers stream.
Defaults to Filesystem::DEFAULT_MAX_FILE_SIZE. copy_file
stays in the browser process and is not capped.
#pub fn scope(
&mut self,
name: impl Into<String>,
declare: impl FnOnce(&mut ScopeBuilder),
) -> ScopeId
Declares a scope and returns its handle. name labels configuration
errors only.
#pub fn grant(
&mut self,
origin: Origin,
scope: ScopeId,
access: FsAccess,
) -> &mut Self
Grants access over scope to origin, matched exactly. Several
grants to one origin combine.
#pub fn build(self) -> Result<Filesystem, FsConfigError>
Opens every allow root and checks every rule.
Errors
Returns FsConfigError for a scope handle from another builder, a
grant to the opaque origin, a malformed deny glob, a deny path outside
its scope’s roots, or an allow root that cannot be opened as a
directory (including every root on platforms without a safe-open
backend).
Trait implementations
impl Default for FilesystemBuilder