zstdutil

package
v0.0.0-...-ae64afa Latest Latest
Warning

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

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

Documentation

Overview

Package zstdutil provides utilities for creating and extracting tar.zst archives.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TarZstdDir

func TarZstdDir(w io.Writer, sourceDir string, level CompressionLevel) error

TarZstdDir creates a tar.zst archive from a directory and writes it to the provided writer. This is a streaming implementation that doesn't buffer the entire archive in memory.

func TarZstdDirToBytes

func TarZstdDirToBytes(sourceDir string, level CompressionLevel) ([]byte, error)

TarZstdDirToBytes creates a tar.zst archive from a directory and returns it as bytes. This is a convenience function for smaller directories where buffering is acceptable.

func UntarZstd

func UntarZstd(r io.Reader, destDir string, stripComponents int) error

UntarZstd extracts a tar.zst archive from the reader to the destination directory. stripComponents specifies the number of leading path components to strip.

Types

type CompressionLevel

type CompressionLevel string

CompressionLevel represents the zstd compression level.

const (
	LevelFastest CompressionLevel = "fastest"
	LevelDefault CompressionLevel = "default"
	LevelBetter  CompressionLevel = "better"
	LevelBest    CompressionLevel = "best"
)

func (CompressionLevel) ToZstdLevel

func (l CompressionLevel) ToZstdLevel() zstd.EncoderLevel

ToZstdLevel converts a CompressionLevel to a zstd.EncoderLevel.

Jump to

Keyboard shortcuts

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