zstdzgo.at/zstd/zimage Index | Files

package zimage

import "zgo.at/zstd/zimage"

Package zimage adds functions for working with images.

Index

Functions

func DetectImage

func DetectImage(data []byte) string

DetectImage detects the image type of the data.

It's a copy of http.DetectContentType with some unnecessary parts removed, making it about 10 times faster.

It returns an empty string if the image type can't be determined.

func DetectImageStream

func DetectImageStream(fp io.ReadSeeker) (string, error)

DetectImageStream works like DetectImage, but operates on a file stream.

It reads the minimal amount of data needed and Seek() back to where the offset was.

Source Files

doc.go sniff.go

Version
v0.0.0-20240930202209-a63c3335042a (latest)
Published
Sep 30, 2024
Platform
linux/amd64
Imports
2 packages
Last checked
2 days ago

Tools for package owners.