magic

package
v2.0.0-...-3265299 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2024 License: MPL-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package magic implements the magic number detection for files and block devices.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Magic

type Magic struct {
	// Value to search for.
	Value []byte

	// Offset in the file where the magic value is located.
	Offset int
}

Magic defines a filesystem/volume manager/etc magic value.

func (*Magic) BlockSize

func (magic *Magic) BlockSize() int

BlockSize returns the size of the buffer that needs to be read from the disk to detect the magic value.

func (*Magic) Matches

func (magic *Magic) Matches(buf []byte) bool

Matches returns true if the magic value is found at the specified offset in the buffer.

Jump to

Keyboard shortcuts

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