codec

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2026 License: Apache-2.0 Imports: 14 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrAlreadyUpToDate = errors.New("codec: target already up-to-date")

ErrAlreadyUpToDate is returned when the target output already matches the descriptor metadata.

Functions

This section is empty.

Types

type Codec

type Codec interface {
	// Type returns the type of the codec.
	Type() Type

	// Encode encodes the target file into a reader.
	Encode(targetFilePath, workDirPath string) (io.Reader, error)

	// Decode reads the input reader and decodes the data into the output path.
	Decode(outputDir, filePath string, reader io.Reader, desc ocispec.Descriptor) error
}

Codec is an interface for encoding and decoding the data.

func New

func New(codecType Type) (Codec, error)

type Type

type Type = string
const (
	// Raw is the raw codec type.
	Raw Type = "raw"

	// Tar is the tar codec type.
	Tar Type = "tar"
)

func TypeFromMediaType

func TypeFromMediaType(mediaType string) Type

TypeFromMediaType returns the codec type from the media type, return empty string if not supported.

Jump to

Keyboard shortcuts

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