binary

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BinaryEngine

type BinaryEngine struct{}

BinaryEngine is the fallback engine for binary files.

func NewEngine

func NewEngine() *BinaryEngine

NewEngine creates a new BinaryEngine.

func (*BinaryEngine) ChunkerFor

func (e *BinaryEngine) ChunkerFor(fileSize int64) chunker.Chunker

ChunkerFor delegates to the shared binary chunker strategy (FastCDC with size-tiered parameters). Explicitly declared here — rather than via an embedded chunker.DefaultSelector on the engine struct — so that the binary package mirrors the file layout of the text/image/video engines (engine.go + chunker.go + differ.go + preview.go).

func (*BinaryEngine) DetectByExtension

func (e *BinaryEngine) DetectByExtension(path string) bool

DetectByExtension returns false; binary matches no specific extension.

func (*BinaryEngine) DetectByHeuristic

func (e *BinaryEngine) DetectByHeuristic(path string, header []byte) bool

DetectByHeuristic returns true; binary is the final fallback engine and matches any file that no other engine claimed.

func (*BinaryEngine) DetectByMagic

func (e *BinaryEngine) DetectByMagic(header []byte) bool

DetectByMagic returns false; binary has no magic signature.

func (*BinaryEngine) Diff

func (e *BinaryEngine) Diff(ctx context.Context, oldPath string, oldReader io.Reader, newPath string, newReader io.Reader) (string, error)

Diff compares two binary files by content streaming from oldReader/newReader rather than buffering either file in memory. It returns a placeholder "binary files differ" message when the bytes are not equal, and an empty string when they are identical. Binary files have no line-based diff.

func (*BinaryEngine) Metadata

func (e *BinaryEngine) Metadata() *core.FileMetadata

Metadata returns the file metadata for binary files.

func (*BinaryEngine) Name

func (e *BinaryEngine) Name() string

Name returns "binary".

func (*BinaryEngine) Preview

func (e *BinaryEngine) Preview(header []byte, size int64, reader io.Reader, maxLines int) (string, error)

Preview returns a placeholder indicating binary content. Binary files have no meaningful text preview.

Jump to

Keyboard shortcuts

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