Table of Contents

Interface IFileTypeDetector

Namespace
HeroKit.FileTypes
Assembly
HeroKit.FileTypes.dll

Recognizes a file type from the first bytes of a file.

public interface IFileTypeDetector
Extension Methods

Remarks

Implement this interface to detect your own file types and pass the detector to Detectors. Built-in detectors are MagicNumber, ZipEntryDetector and IsoMediaDetector.

Methods

IsMatch(ReadOnlySpan<byte>)

Checks whether the first bytes of a file belong to the file type.

bool IsMatch(ReadOnlySpan<byte> header)

Parameters

header ReadOnlySpan<byte>

The first bytes of the file; HeaderSize bytes when read from a stream. It can be shorter than the file. For a ZIP file read from a seekable stream, the ZIP central directory follows the first bytes.

Returns

bool

True if the bytes match.