codec

package
v0.0.4-rc.0 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

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