read() and file handling¶
import { read, MZMLFile, MSZFile } from "mscompress";
const f = read("anything.mzML"); // returns MZMLFile
const g = read("anything.msz"); // returns MSZFile
read() inspects the file's magic bytes — the MSZ tag 0x035F51B5 — and
returns the right concrete class. Both extend BaseFile, so most code
can work against the shared surface.
Direct construction¶
File-level metadata¶
Resource cleanup¶
Always call close() when done:
Spectra hold references back into the file's mmap; reading them after
close() throws.
The bindings work with the
using declaration
when your TypeScript target supports it: