dhara_storage
Rust runtime for content-based file analysis, file and directory handles, transfers with progress and cancellation, directory watching, and shell metadata.
Use this crate when you want those capabilities from Rust—with memory safety, thread safety, and fearless concurrency under heavy I/O and analysis.
Why this crate
- Signature-based typing via bundled
filedefs.dat(not extension-only guessing) FileStorage/DirectoryStoragehandles for navigation and I/O- Analyze on the handle (
analyze), thenmetadata()for attrs/perms/type enriched from the cache - Sync-first copy / move / delete; copy/move start a
StorageProcess(await or wait) withStorageProcessEventprogress and cancellation - Shared opens via
open_for_read/open_for_write(FileShareMode, optional lock timeout; write default exclusive) - Debounced directory change events
- Shell icons (RGBA) on supported desktops
- Optional Tokio wrappers (
async-tokio) for non–copy/move helpers
Prerequisites
- Rust stable toolchain (
cargo)
Install
[]
= "0.10.1"
Optional async:
= { = "0.10.1", = ["async-tokio"] }
Usage
1. Analyze a path
use analyze_path;
let report = analyze_path?;
# Ok::
2. Analyze on a handle, then read metadata
use FileStorage;
let file = from_existing?;
let report = file.analyze?;
let metadata = file.metadata?; // type / extension enriched from the cached analysis
let _ = ;
# Ok::
3. Open a file handle and read
use FileStorage;
let bytes = from_existing?.read?;
# Ok::
4. List a directory
use DirectoryStorage;
let files = from_existing?.files?;
# Ok::
5. Copy with process events
use Arc;
use ;
let progress = new;
// Sync: starts a process and waits inside (returns ()).
from_existing?.copy_to_with_options?;
// Or start and await the process (destination on ProcessOutcome).
// let outcome = FileStorage::from_existing("input.bin")?
// .start_copy_to_with_options("output.bin", TransferOptions { overwrite: true, ..Default::default() })
// .await?;
# Ok::
Platform notes
| Capability | Windows | Linux | macOS |
|---|---|---|---|
| Analysis, I/O, watching | yes | yes | yes |
ShellIcon (RGBA) |
yes | yes* | yes |
*Linux GTK icons may require the main thread. ShellIcon returns raw RGBA pixels—encode to PNG in your app if needed.
Related
- Framework crate (DSFD, process session / events, portable types): dhara_storage_core
- Product overview: Dhara Storage
- API docs: docs.rs/dhara_storage
Extension crates may depend on this runtime and compose FileStorage / DirectoryStorage (for example a future archives crate). Apps that need a closed mixed collection of handle kinds should use a consumer-owned enum.
License
Apache-2.0.