codec

package
v0.0.5 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsRawMediaType added in v0.0.5

func IsRawMediaType(mediaType string) bool

IsRawMediaType returns true if the media type is raw.

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