ofx-data-extractor is a TypeScript library for parsing, normalizing and validating OFX files in Node.js and browser environments.
- Installation
- Quick Start
- Node.js
- Browser (
fromBlobis async) - Main Public API (
Ofx) - Configuration (Extract)
- Developer Documentation
- Examples
- License
npm install ofx-data-extractoryarn add ofx-data-extractorimport { Ofx } from 'ofx-data-extractor'
const data = 'OFXHEADER:100\nDATA:OFXSGML\nVERSION:102\n...'
const ofx = new Ofx(data)
const raw = ofx.toJson()
const summary = ofx.getTransactionsSummary()
const normalized = ofx.toNormalized()
const validation = ofx.validate()import fs from 'fs'
import { Ofx } from 'ofx-data-extractor'
const file = fs.readFileSync('/path/to/file.ofx')
const ofx = Ofx.fromBuffer(file)
console.log(ofx.getTransactionsSummary())import { Ofx } from 'ofx-data-extractor'
async function handleFile(event: Event) {
const input = event.target as HTMLInputElement
const file = input.files?.[0]
if (!file) return
const ofx = await Ofx.fromBlob(file)
console.log(ofx.toJson())
}new Ofx(data: string, config?: ExtractorConfig)Ofx.fromBuffer(buffer: Buffer)Ofx.fromBlob(blob: Blob)config(options)getType()getHeaders()getBankTransferList()getCreditCardTransferList()getTransactionsSummary()getContent()toJson()toNormalized(options?)validate()getWarnings()
nativeTypes?: booleanfitId?: 'normal' | 'separated'formatDate?: stringparserMode?: 'strict' | 'lenient'
Parser mode:
strict(default): parsing errors throw.lenient: parsing errors fallback and are collected viagetWarnings().
MIT