parseHeader
function parseHeader(bytes, options?): ParseHeaderResult;Defined in: header/parse-header.ts:59
Parse a FITS header from the start of bytes.
Walks the 2880-byte header blocks, parsing 80-character cards until the
END keyword, and resolves the CONTINUE long-string convention. The byte
source is not consulted beyond the header, so this works on an in-memory
buffer; streaming and random-access readers are layered on top elsewhere.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
bytes |
Uint8Array |
options |
ParseHeaderOptions |
Returns
Section titled “Returns”Example
Section titled “Example”Read keywords from a primary header
import { parseHeader } from "@fits-js/core";
const { header, byteLength } = parseHeader(bytes);header.getNumber("NAXIS"); // 2header.getString("OBJECT"); // "M51"// pixel data begins at byteLength