Skip to main content

Module web

Module web 

Source
Available on crate feature web only.
Expand description

An implementation of filesystem operations for the web

This module implements the git-async filesystem operations using either the Web File System API or the File and Directory Entries API.

§Examples

Using the Web File System API:

async fn open_repo(handle: &web_sys::FileSystemDirectoryHandle) -> Result<Repo<WebFileSystem>, JsError> {
    let repo = Repo::open(WebDirectory::new(handle)?)
        .await
        .map_err(|e| JsError::new(&format!("{:?}", e)))?;
    Ok(repo)
}

Using the Web File and Directory Entries API:

async fn open_repo(file_list: &web_sys::FileList) -> Result<Repo<WebFileSystem>, JsError> {
    let repo = Repo::open(WebDirectory::new(file_list)?)
        .await
        .map_err(|e| JsError::new(&format!("{:?}", e)))?;
    Ok(repo)
}

Structs§

WebDirectory
A provider for the Directory trait which delegates to web APIs
WebFile
A provider for the File trait which delegates to web APIs
WebFileSystem
File system operations using web APIs