Crate mini_fs

Source
Expand description

mini-fs is an extensible virtual filesystem for the application layer.

Currently supported features include:

  • Access to the local (native) filesystem.
  • In-memory filesystems.
  • Read from tar, tar.gz, and zip archives.
  • Filesystem overlays.

§Case sensitivity

All implementations of Store from this crate use case sensitive¹ paths. However, you are free to implement custom stores where paths are case insensitive.

¹ Except maybe LocalFs, which uses std::fs internally and is subject to the underlying OS.

§Example

use mini_fs::prelude::*;
use mini_fs::{LocalFs, MiniFs, ZipFs};

let gfx = LocalFs::new("./res/images");
let sfx = ZipFs::open("archive.zip")?;

let assets = MiniFs::new().mount("/gfx", gfx).mount("/sfx", sfx);

let root = MiniFs::new().mount("/assets", assets);

let file = root.open("/assets/gfx/trash.gif")?;

§Security

Don’t use this crate in applications where security is a critical factor. LocalFs in particular might be vulnerable to directory traversal attacks, so it’s best not to use it directly in a static file server, for example.

Re-exports§

pub use caseless::CaselessFs;
pub use tar::TarFs;
pub use zip::ZipFs;

Modules§

caseless
This module contains a caseless filesystem.
prelude
Convenient library imports.
tar
Tar file storage.
zip
Zip file storage.

Structs§

Entries
Iterator of file entries.
Entry
File or directory entry.
LocalFs
Native file store.
MiniFs
Virtual filesystem.
RamFile
In-memory file.
RamFs
In-memory file storage

Enums§

EntryKind
Type of file entry.
File
File you can seek and read from.

Traits§

Store
Generic file storage.
StoreExt
Convenient methods on top of Store.
UserFile
Custom file type.