imageio

package
v0.30.20 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 4, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package imageio bridges v1.Image / v1.ImageIndex and the local filesystem: loading and saving tarballs (docker format) and OCI image layouts.

Index

Constants

View Source
const (
	PullFormatTarball = "tarball"
	PullFormatLegacy  = "legacy"
	PullFormatOCI     = "oci"
)

Pull output formats. Single source of truth - the cobra command (basic/pull.go) and the shell-completion enum (cmd/completion) both read from here.

Variables

This section is empty.

Functions

func LoadLocal

func LoadLocal(path string, asIndex bool) (partial.WithRawManifest, error)

LoadLocal inspects path and returns a v1.Image or v1.ImageIndex.

path is a file          -> docker tarball, returns v1.Image
path is an OCI layout   -> contents determine the type:
                           - exactly one image manifest                 -> v1.Image
                           - exactly one nested index                   -> v1.ImageIndex (unwrapped, --index optional)
                           - several entries with asIndex = true        -> v1.ImageIndex (the layout's top-level index)
                           - several entries without asIndex            -> error (ambiguous)

func LoadTarball

func LoadTarball(path, tag string) (v1.Image, error)

LoadTarball reads a docker-format tarball from path. When tag is non-empty it picks the matching manifest entry; otherwise the first/only entry.

func PullFormats

func PullFormats() []string

PullFormats returns a defensive copy of the format enum suitable for cobra completion or help-text generation.

func SaveLegacy

func SaveLegacy(path string, imgs map[string]v1.Image) error

SaveLegacy writes imgs to path as a legacy docker-format tarball, which understands only tagged references (no digests) but is readable by old `docker load` versions. Empty maps are rejected for the same reason as SaveTarball.

func SaveOCI

func SaveOCI(path string, imgs map[string]v1.Image, idxs map[string]v1.ImageIndex) error

SaveOCI appends images and indices to an OCI image-layout directory at path, creating it if missing.

func SaveTarball

func SaveTarball(path string, imgs map[string]v1.Image) error

SaveTarball writes imgs to path as a modern docker-compatible tarball (references may be digests or tagged names). An empty map is rejected: the resulting file would have no manifest.json and LoadTarball could not read it back, so callers see a clean error instead of a malformed artifact.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL