Skip to content

web-based replacement for std::fs using localStorage

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

iceiix/localstoragefs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

localstoragefs

Web-based replacement for std::fs using localStorage

Intended as a drop-in replacement when building for wasm32-unknown-unknown for HTML5. Example of supporting both native and web with the same API using cfg-if:

cfg_if! {
    if #[cfg(target_arch = "wasm32")] {
        use localstoragefs::fs;
    } else {
        use std::fs;
    }
}

then use fs::File as usual. Not all functionality is supported (contributions welcome), but at least minimal usage should work. See examples/hello for a complete example.

Inspired by Emscripten's file system support (Rust target wasm32-unknown-emscripten), but not as complete. Files are stored as local storage string values with hex-encoded data. May not be as efficient as alternatives.

About

web-based replacement for std::fs using localStorage

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Packages

No packages published

Languages