Table of Contents

Method ReadFromStream

Namespace
LMKit.Model.Gguf
Assembly
LM-Kit.NET.dll

ReadFromStream(Stream, bool)

Reads GGUF metadata from stream, starting at its current position, which must be the GGUF magic. The stream position is not preserved.

public static GgufMetadata ReadFromStream(Stream stream, bool leaveOpen = true)

Parameters

stream Stream

Readable, seekable stream positioned at the GGUF magic.

leaveOpen bool

true to leave stream open after reading (the default); false to dispose it.

Returns

GgufMetadata

The parsed metadata.

Exceptions

ArgumentNullException

stream is null.

ArgumentException

stream is not readable or not seekable.

InvalidModelException

The stream does not carry a valid GGUF v2/v3 payload, is truncated, or declares metadata that exceeds the safety ceilings.

Share