Expand description

A library for manipulating assets in an asset canister.

Example

use ic_agent::agent::{Agent, http_transport::ReqwestHttpReplicaV2Transport};
use ic_agent::identity::BasicIdentity;
use ic_utils::Canister;
use std::time::Duration;
let agent = Agent::builder()
    .with_transport(ReqwestHttpReplicaV2Transport::create(replica_url)?)
    .with_identity(BasicIdentity::from_pem_file(pemfile)?)
    .build()?;
let canister = Canister::builder()
    .with_canister_id(canister_id)
    .with_agent(&agent)
    .build()?;
ic_asset::sync(&canister, concat!(env!("CARGO_MANIFEST_DIR"), "assets/").as_ref(), Duration::from_secs(60)).await?;

Functions

Sets the contents of the asset canister to the contents of a directory, including deleting old assets.

Upload the specified files