Skip to main content

Crate libfw_client

Crate libfw_client 

Source
Expand description

libfw-client: reusable client-side transfer logic and browser glue.

The crate is intentionally split into a reusable Rust library core and a thin wasm bridge. This allows the client logic to be consumed by Rust code directly, while the JS/browser-facing API remains in the dedicated WASM module.

§Two client forms, one protocol

  • Native Rust (native::NativeClient, any non-wasm32 target): an async tokio + reqwest transport implementing the same wire protocol — resumable Range downloads, the session upload protocol, zrip compression and the same adaptive tuning engine. Enable it by depending on this crate from a normal Rust binary/library.
  • Browser/WASM (LibfwClient, wasm32 only): the engine behind the sdk/ npm package, which additionally supports the File System Access API and IndexedDB resume state. Its JavaScript API is documented in sdk/README.md and sdk/index.d.ts.

Modules§

native
Native (non-WASM) Rust client: async reqwest transport speaking the same wire protocol as the browser engine. Native (non-WASM) client: an async Rust transport for the libfw protocol.

Structs§

Capabilities
Full capability advertisement served at GET /capabilities.
ClientConfig
Runtime configuration of the WASM engine.
FileEntry
A file to transfer, identified by its virtual path.
IntRange
Inclusive integer range with a server-chosen default.
Limits
Tuning-parameter ranges the server will tolerate.
TuneEvent
A tuning event emitted when a window evaluation changed the state.
TuneParams
The shared, live parameter table.
TuneStats
Smoothed transfer statistics.
ZripLevels
Zrip (zstd) level range advertised by the server.

Enums§

CompressLevel
Client-side compression level configuration.
CompressionFormat
Compression formats understood by libfw.
LibfwError
Errors produced by the WASM engine.
TransferKind
Which transfer direction is ramping (drives which window/chunk dims move).
TunePhase
Lifecycle of the tuning state machine.

Functions§

backoff_ms
Pure exponential backoff: min(max, base << attempt) with saturation.

Type Aliases§

TuneHandle
Shared handle to the tuning engine (Rc so clones share one table).