15 releases (4 breaking)

0.9.0 Dec 10, 2024
0.8.5 Nov 20, 2024
0.8.2 Oct 30, 2024
0.7.4 Oct 3, 2024
0.5.1 Sep 6, 2024

#138 in WebAssembly

Download history 192/week @ 2024-09-20 628/week @ 2024-09-27 772/week @ 2024-10-04 2132/week @ 2024-10-11 3905/week @ 2024-10-18 6660/week @ 2024-10-25 3602/week @ 2024-11-01 3030/week @ 2024-11-08 5172/week @ 2024-11-15 4607/week @ 2024-11-22 5823/week @ 2024-11-29 4410/week @ 2024-12-06 3949/week @ 2024-12-13 2283/week @ 2024-12-20 2027/week @ 2024-12-27 904/week @ 2025-01-03

10,224 downloads per month
Used in 8 crates (7 directly)

Apache-2.0 WITH LLVM-exception

135KB
2.5K SLoC

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

lib.rs:

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?;
}

Dependencies

~34–54MB
~888K SLoC