Skip to content

@alex.garcia/libfec / FilingReader

Class: FilingReader ​

Defined in: reader.ts:164

A filing being streamed; see open. Its header, cover, coverSummary and coverRow are read up front and stay available after close.

Implements ​

  • Iterable<Row<null>>
  • Disposable

Properties ​

id ​

readonly id: string | null

Defined in: reader.ts:169

The filing ID: OpenOptions.id if given, else from the file name ("1805248" for FEC-1805248.fec); null for bytes without an id.


fecVersion ​

readonly fecVersion: string

Defined in: reader.ts:171

The filing's format version: "8.4", "3.00", "P3.4" (paper).


readonly header: Header

Defined in: reader.ts:173

The filing's header.


cover ​

readonly cover: Cover | null

Defined in: reader.ts:178

The typed cover record, narrowed with switch (filing.cover?.type); null when the form has no typed struct.


coverSummary ​

readonly coverSummary: CoverSummary

Defined in: reader.ts:180

The six cover fields every form has.


coverRow ​

readonly coverRow: Row<null>

Defined in: reader.ts:182

The cover record as a raw Row.

Accessors ​

invalidValues ​

Get Signature ​

get invalidValues(): readonly InvalidValue[]

Defined in: reader.ts:219

Amounts and dates that didn't parse, in file order: the first 1,000.

Returns ​

readonly InvalidValue[]


invalidValueCount ​

Get Signature ​

get invalidValueCount(): number

Defined in: reader.ts:224

How many amounts and dates didn't parse, uncapped.

Returns ​

number


skippedRows ​

Get Signature ​

get skippedRows(): readonly SkippedRow[]

Defined in: reader.ts:229

Rows rows() skipped with unknownRows: "skip".

Returns ​

readonly SkippedRow[]


closed ​

Get Signature ​

get closed(): boolean

Defined in: reader.ts:234

Whether close has been called.

Returns ​

boolean

Methods ​

itemizations() ​

itemizations(): Generator<Row<Itemization>, void, undefined>

Defined in: reader.ts:247

Every row that has a typed record (Itemization), as a Row<Itemization>: narrow it with switch (row.itemization.type). Rows without one (summary rows, schedules with no struct yet) are skipped. Typing every row costs about three times rows.

Returns ​

Generator<Row<Itemization>, void, undefined>

Throws ​

FecError ERR_FILING_CONSUMED if the reader was already read, ERR_FILING_CLOSED if it is closed.


rows() ​

rows(): Generator<Row<null>, void, undefined>

Defined in: reader.ts:262

Every row after the cover, untyped (row.itemization is null): the fast path when you only need Row.values.

Returns ​

Generator<Row<null>, void, undefined>

Throws ​

MissingMappingError for a row type with no mapping (see OpenOptions.unknownRows); FecError ERR_FILING_CONSUMED or ERR_FILING_CLOSED as for itemizations.


records() ​

records(): Generator<RawRecord, void, undefined>

Defined in: reader.ts:269

Every row after the cover as raw strings, with no column mapping needed.

Returns ​

Generator<RawRecord, void, undefined>


[iterator]() ​

[iterator](): Generator<Row<null>, void, undefined>

Defined in: reader.ts:276

for (const row of filing) is rows.

Returns ​

Generator<Row<null>, void, undefined>

Implementation of ​

Iterable.[iterator]


close() ​

close(): void

Defined in: reader.ts:281

Release the file (or buffer). Idempotent; the header and cover stay readable.

Returns ​

void


[dispose]() ​

[dispose](): void

Defined in: reader.ts:287

= close, for using.

Returns ​

void

Implementation of ​

Disposable.[dispose]