New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

fec-parse

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fec-parse

A Node module to parse raw FEC electronic filings.

  • 0.25.0
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

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

This uses code from the Fech Ruby gem by Derek Willis and others, and the 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.

Installation

npm i fec-parse

Usage

Parse from downloaded file

wget http://docquery.fec.gov/dcdev/posted/876050.fec
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

npm install --save request JSONStream
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`));

FAQs

Package last updated on 30 Aug 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc