16 releases (5 breaking)

0.10.0 Jan 31, 2025
0.9.0 Dec 10, 2024
0.8.5 Nov 20, 2024
0.8.2 Oct 30, 2024
0.5.1 Sep 6, 2024

#158 in WebAssembly

Download history 2002/week @ 2025-02-01 1776/week @ 2025-02-08 2010/week @ 2025-02-15 1732/week @ 2025-02-22 1843/week @ 2025-03-01 3519/week @ 2025-03-08 3927/week @ 2025-03-15 2356/week @ 2025-03-22 2749/week @ 2025-03-29 2860/week @ 2025-04-05 1585/week @ 2025-04-12 2065/week @ 2025-04-19 2545/week @ 2025-04-26 2917/week @ 2025-05-03 2670/week @ 2025-05-10 2568/week @ 2025-05-17

10,950 downloads per month
Used in 12 crates (8 directly)

Apache-2.0 WITH LLVM-exception

135KB
2.5K SLoC

Wasm Package Client

Client implements a unified interface for loading package content from multiple kinds of package registries.

Example

// Initialize client from global configuration.
let mut client = wasm_pkg_client::Client::with_global_defaults().await?;

// Get a specific package release version.
let pkg = "example:pkg".parse()?;
let version = "1.0.0".parse()?;
let release = client.get_release(&pkg, &version).await?;

// Stream release content to a file.
let mut stream = client.stream_content(&pkg, &release).await?;
let mut file = tokio::fs::File::create("output.wasm").await?;
use futures_util::TryStreamExt;
use tokio::io::AsyncWriteExt;
while let Some(chunk) = stream.try_next().await? {
    file.write_all(&chunk).await?;
}

Wasm Package Client

A minimal Package Registry interface for multiple registry backends.

Running Tests

The e2e tests require an OCI Distribution Spec-compliant registry to be running at localhost:5000. An ephemeral registry can be run with:

$ docker run --rm -p 5000:5000 distribution/distribution:edge

The e2e tests themselves are in the separate tests/e2e crate:

$ cd tests/e2e
$ cargo run

Dependencies

~35–60MB
~1M SLoC