Menu

Struct

FilesystemBuilder

kurogane::capability::FilesystemBuilderSource
pub struct FilesystemBuilder { /* private fields */ }

Builder for Filesystem.

Methods

#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