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§
Structs§
- Client
- A read-only registry client.
- Config
- Wasm Package registry configuration.
- Custom
Config - Custom registry configuration
- Package
Ref - A package reference, consisting of kebab-case namespace and name.
- Publish
Opts - Additional options for publishing a package.
- Registry
- A registry identifier.
- Registry
Metadata - Release
- Package release details.
- Version
- SemVer version as defined by https://semver.org.
- Version
Info
Enums§
- Content
Digest - A cryptographic digest (hash) of some content.
- Error
- Registry
Mapping - Possible options for namespace configuration.
Traits§
- Reader
Seeker - A supertrait combining tokio’s AsyncRead and AsyncSeek.
Type Aliases§
- Content
Stream - An alias for a stream of content bytes
- Publishing
Source - An alias for a PublishingSource (generally a file)