/** * Header prefetch and record-range translation. * * Layer 6. Nothing here interprets a byte: this module decides WHICH bytes to ask a `ByteSource` * for, and hands them to the pure layer unchanged. Two rules are the whole file. * * 1. A header costs exactly TWO source reads — 256 bytes to learn the signal count, then the * remaining `256 * ns` as one range. Never one read per signal block, and never a speculative * read of a size the file has not stated. * 2. The unit of I/O is the RECORD RANGE, never the channel range. `readRecordBytes` issues one * contiguous read covering every signal over the requested records, and de-interleaving * happens in memory afterwards. There is no cheap single-channel read in EDF. Ten seconds of * ONE channel out of thirty at 256 Hz is the same 153,600-byte read as all thirty, of which * 5,120 bytes are the channel asked for: one request, 30x overread. The alternative collects * the stripes a record at a time — ten requests of 512 bytes, no overread at all, and ten * round trips instead of one. `large-files.md` works the same window through both. This said * "a 27x overread spread over ten requests" until 0.6.73, which is neither strategy and * neither number. * * The exact-length contract is re-verified here even though every bundled adapter already checks * it, because a `ByteSource` may be the caller's own and a silently short read is * indistinguishable from a truncated file. */ import type { ByteSource, EdfHeader, OpenOptions, ReadOptions, RecordRange } from '../types.js'; /** * Parse the header of `source`, reading it in exactly two ranges. * * Both reads are clamped to the source length so that a file too short for the header it declares * reaches `parseHeader` and is reported as `SOURCE_TOO_SMALL` — a file defect — instead of * surfacing as an `EdfSourceError` about a range past the end, which would blame the source for * the file's problem. */ export declare function readHeader(source: ByteSource, options?: OpenOptions): Promise; /** * The bytes of a record range: ONE contiguous read covering every signal. * * The returned buffer is exactly `records.count * header.recordByteLength` bytes and begins at * record `records.start`, which is precisely what `decodeDigital` and `decodeAnnotations` demand * — pass it to them unsliced. * * A zero-record range issues no read at all. A zero-length HTTP range is not expressible (`bytes= * n--1`), and there is nothing to fetch, so returning the empty buffer is both cheaper and more * honest than asking for it. */ export declare function readRecordBytes(source: ByteSource, header: EdfHeader, records: RecordRange, options?: ReadOptions): Promise; //# sourceMappingURL=read.d.ts.map