# fec-parse

> A Node module to parse raw FEC electronic filings.

Latest version **0.28.0** (published 2025-04-24) · (Apache-2.0 AND MIT) license · 0 weekly downloads

## Install

```sh
npm install fec-parse
pnpm add fec-parse
yarn add fec-parse
bun add fec-parse
```

## Health

**Score 30/100 (F)** — status: maintenance-mode.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.28.0 |
| Published | 2025-04-24 |
| First published | 2015-11-09 |
| Weekly downloads | 0 |
| License | (Apache-2.0 AND MIT) |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 5 |
| Unpacked size | 1009.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Maintainers | chriszs |

## Links

- npm: https://www.npmjs.com/package/fec-parse
- Repository: https://github.com/chriszs/fec-parse
- Homepage: https://github.com/chriszs/fec-parse#readme
- Issues: https://github.com/chriszs/fec-parse/issues
- npm.io page: https://npm.io/package/fec-parse

## Dependencies (5)

- [inherits](https://npm.io/package/inherits.md) ^2.0.4
- [string_decoder](https://npm.io/package/string_decoder.md) ^1.3.0
- [generate-function](https://npm.io/package/generate-function.md) ^2.3.1
- [stream-browserify](https://npm.io/package/stream-browserify.md) ^3.0.0
- [generate-object-property](https://npm.io/package/generate-object-property.md) ^1.2.0

## Recent versions

- 0.28.0 (latest) — 2025-04-24
- 0.27.0 — 2022-06-28
- 0.26.0 — 2021-08-30
- 0.25.0 — 2021-08-30
- 0.24.0 — 2021-08-30
- 0.23.0 — 2021-06-24
- 0.22.0 — 2019-11-30
- 0.21.0 — 2019-11-30
- 0.20.0 — 2019-11-30
- 0.19.0 — 2019-04-28
- 0.18.0 — 2019-04-28
- 0.17.0 — 2018-10-28
- 0.16.0 — 2018-08-21
- 0.15.0 — 2018-08-21
- 0.14.0 — 2018-08-21
- … 14 more at https://npm.io/package/fec-parse/versions

## README

This is an unofficial Node.js parser for electronic filings submitted to the Federal Election Commission.

This uses code from the [Fech](https://github.com/NYTimes/Fech) Ruby gem by Derek Willis and others, and the [csv-parser](https://github.com/mafintosh/csv-parser) module by Mathias Buus, Max Ogden and others. It uses header mappings contributed to by many and refined by Evan Sonderegger for [fecfile](https://github.com/esonderegger/fecfile).

## Installation

```shell
npm i fec-parse
```

## Usage

### Parse from downloaded file

```shell
wget http://docquery.fec.gov/dcdev/posted/876050.fec
```

```js
import fs from "fs";
import parser from "fec-parse";

const filingId = "876050"; // Obama for America 2012 post-general report

fs.createReadStream(`${filingId}.fec`)
  .pipe(parser())
  .on("data", (row) => {
    console.log(row);
  })
  .on("error", (err) => {
    console.error(err);
  })
  .on("finish", () => {
    console.log("done");
  });
```

### Download and parse in one

```sh
npm install --save request JSONStream
```

```js
import fs from "fs";
import parser from "fec-parse";
import request from "request";
import JSONStream from "JSONStream";

const filingId = "876050";

request(`http://docquery.fec.gov/dcdev/posted/${filingId}.fec`)
  .pipe(parser())
  .pipe(JSONStream.stringify('{"rows":[\n', ",\n", "\n]}"))
  .pipe(fs.createWriteStream(`${filingId}.json`));
```

---
_Source: https://npm.io/package/fec-parse · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
