@alex.garcia/libfec / open
Function: open()
open(
source,options?):FilingReader
Defined in: reader.ts:155
Open a filing for streaming. The header and cover are read now; rows are read as you iterate, one batch at a time.
Read it with one of FilingReader.itemizations, FilingReader.rows or FilingReader.records, then close it:
ts
const filing = open("1805248.fec");
try {
for (const row of filing.itemizations()) {
switch (row.itemization.type) {
case "ScheduleA": console.log(row.itemization.contribution_amount); break;
}
}
} finally {
filing.close();
}On Node 24+, Deno and Bun, using filing = open(…) closes it for you.
A bytes source is read in place: don't modify it while the reader is open.
Parameters
source
A path, a file: URL, or the file's bytes.
options?
OpenOptions = {}
Returns
Throws
A Node-style error (code: "ENOENT", …) if the path can't be opened, or FecParseError if the header or cover can't be parsed.