archive

package
v0.1.0-beta.1 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2026 License: Apache-2.0 Imports: 6 Imported by: 0 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

Overview

Package archive identifies backup files from their contents.

Index

Constants

View Source
const (
	// SniffSize is how many bytes SniffBytes needs to recognise a format.
	SniffSize = 8 * 1024
)

Variables

This section is empty.

Functions

func Decompress

func Decompress(format Format, compressed io.Reader) (io.ReadCloser, error)

Decompress returns a reader for gzip or zstd data. Damaged data is reported while reading.

func PlainDumpTruncated

func PlainDumpTruncated(file io.ReaderAt, size int64) (bool, error)

PlainDumpTruncated reports whether a pg_dump plain file lost its end. psql exits successfully on such a file, because it can't tell a short file from a finished one. Only pg_dump's own output has the footer, so SQL files without its header are never reported.

Types

type Format

type Format string

Format is the kind of file a backup turned out to be.

const (
	FormatEmpty   Format = "empty"
	FormatUnknown Format = "unknown"
	FormatCustom  Format = "custom"
	FormatPlain   Format = "plain"
	FormatGzip    Format = "gzip"
	FormatZstd    Format = "zstd"
	FormatAge     Format = "age"
	FormatPGP     Format = "pgp"
)

Formats the runner can recognise.

func Sniff

func Sniff(r io.Reader) (Format, error)

Sniff detects the format from the first bytes of r, because file extensions can't be trusted.

func SniffBytes

func SniffBytes(sample []byte) Format

SniffBytes detects the format from the first bytes of a file.

Jump to

Keyboard shortcuts

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