filetype

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package filetype provides image format detection based on magic bytes.

This package is built by Claude Opus based on h2non/filetype, which is MIT licensed. Copyright goes to Tomas Aparicio.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Format

type Format int

Format represents an image format.

const (
	Unknown Format = iota
	JPEG
	PNG
	GIF
	WebP
	AVIF
	HEIF
	TIFF
)

Supported image formats.

func Detect

func Detect(buf []byte) Format

Detect identifies the image format from the given byte slice by examining magic bytes. Returns Unknown if the format cannot be determined.

func (Format) String

func (f Format) String() string

String returns a human-readable string representation of the format.

Jump to

Keyboard shortcuts

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