ocipkg icon indicating copy to clipboard operation
ocipkg copied to clipboard

Removal of `get_layer_bytes()`

Open CodeMan99 opened this issue 1 year ago • 1 comments

Hello,

I see that the 0.3.x line has removed get_layer_bytes() that I added in #94. Can this helper be restored?

CodeMan99 avatar Jul 30 '24 16:07 CodeMan99

You can use OciArtifact::get_layers rather than ocipkg::distribution::get_layer_bytes:

        let Some((_descriptor, blob)) = OciArtifact::from_remote(image_name.clone())?
            .get_layers()?
            .into_iter()
            .find(|(descriptor, _blob)| match descriptor.media_type() {
                MediaType::ImageLayerGzip => true,
                // application/vnd.docker.image.rootfs.diff.tar.gzip case
                MediaType::Other(x) if x.ends_with("tar.gzip") => true,
                _ => false,
            })
        else {
            bail!("Failed to find GZIP layer in {image_name}");
        };

sjackman avatar Apr 08 '25 00:04 sjackman