Crate wasm_pkg_client

Source
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§

caching
local
Local filesystem-based package backend.
oci
OCI package client.
warg
Warg package backend.

Structs§

Client
A read-only registry client.
Config
Wasm Package registry configuration.
CustomConfig
Custom registry configuration
PackageRef
A package reference, consisting of kebab-case namespace and name.
PublishOpts
Additional options for publishing a package.
Registry
A registry identifier.
RegistryMetadata
Release
Package release details.
Version
SemVer version as defined by https://semver.org.
VersionInfo

Enums§

ContentDigest
A cryptographic digest (hash) of some content.
Error
RegistryMapping
Possible options for namespace configuration.

Traits§

ReaderSeeker
A supertrait combining tokio’s AsyncRead and AsyncSeek.

Type Aliases§

ContentStream
An alias for a stream of content bytes
PublishingSource
An alias for a PublishingSource (generally a file)