Skip to content

Pure JavaScript parser for Open Financial Exchange (OFX) files

License

Notifications You must be signed in to change notification settings

bradenmacdonald/ofx-js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OFX JS

Parse Open Financial Exchange (OFX) files into a usable data structure.

For details on the OFX file format, download the latest specification from http://www.ofx.org/downloads.html

NPM Version NPM Downloads

Goals

  • Work in the browser (no native code dependencies)
  • Have as small a footprint as possible (minimize dependencies)
    • Currently, xml2js is the only dependency and it may be removed in the future.
  • Parse only, no serialization
  • Make no attempt to support pre-ES6 runtimes

History

This is based on node-ofx, modified to be a pure-JavaScript implementation (so it works in the browser as well as in node.js) and to offer a promise-based API. Due to different goals and a different XML parser being used, it is not API-compatible and is probably slower.

Usage

Installation:

npm install ofx-js

Example usage:

import {parse as parseOFX} from 'ofx-js';

const ofxString = readFile("bank-statement.ofx");

parseOFX(ofxString).then(ofxData => {
    const statementResponse = ofxData.OFX.BANKMSGSRSV1.STMTTRNRS.STMTRS;
    const accountId = statementResponse.BANKACCTFROM.ACCTID;
    const currencyCode = statementResponse.CURDEF;
    const transactionStatement = statementResponse.BANKTRANLIST.STMTTRN;
    // do something...
});

About

Pure JavaScript parser for Open Financial Exchange (OFX) files

Resources

License

Stars

Watchers

Forks

Packages

No packages published