archive

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

© Ben Garrett https://github.com/bengarrett/dupers

Index

Constants

View Source
const (
	Mime7z   = "application/x-7z-compressed"       // 7-Zip type.
	MimeAr   = "application/x-unix-archive"        // ar (Unix) type.
	MimeBZ2  = "application/x-bzip2"               // bzip2 type.
	MimeCab  = "application/vnd.ms-cab-compressed" // Microsoft cabinet type.
	MimeGZ   = "application/gzip"                  // GNU Zip type.
	MimeLZ   = "application/x-lzip"                // LZ type.
	MimeLZ4  = "application/x-lz4"                 // LZ4 type.
	MimeRAR  = "application/vnd.rar"               // RAR type.
	MimeSnap = "application/x-snappy-framed"       // Snappy type.
	MimeTar  = "application/x-tar"                 // Tape archive type.
	MimeX    = "application/x-compress"            // Huffman type.
	MimeXZ   = "application/x-xz"                  // XZ type.
	MimeZ    = "application/zstd"                  // Zstandard type.
	MimeZip  = "application/zip"                   // ZIP type.

	Ext7z = ".7z" // Ext7z is the 7-Zip file extension.
)

Variables

View Source
var (
	ErrFilename = errors.New("filename is not a supported archive")
	ErrType     = errors.New("archiver type is unsupported")
)

Functions

func Extension

func Extension(find string) string

Extension finds either a compressed file extension or mime type and returns its match.

func MIME

func MIME(name string) string

MIME returns the application MIME type of a filename based on its extension.

func ReadMIME

func ReadMIME(name string) (string, error)

ReadMIME opens and reads the named file and returns its compressed application MIME type. If the compression format is unsupported or unknown an error is returned.

func Supported

func Supported(f any) bool

Supported returns true when the archiver format structure is valid.

Types

This section is empty.

Jump to

Keyboard shortcuts

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