Expand description
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?;
}Modules§
- Local filesystem-based package backend.
- OCI package client.
- Warg package backend.
Structs§
- A read-only registry client.
- Wasm Package registry configuration.
- Custom registry configuration
- A package reference, consisting of kebab-case namespace and name.
- Additional options for publishing a package.
- A registry identifier.
- Package release details.
- SemVer version as defined by https://semver.org.
Enums§
- A cryptographic digest (hash) of some content.
- Possible options for namespace configuration.
Traits§
- A supertrait combining tokio’s AsyncRead and AsyncSeek.
Type Aliases§
- An alias for a stream of content bytes
- An alias for a PublishingSource (generally a file)