Neural Processing Mechanisms

    @hublaw/ofx-parser
    TypeScript icon, indicating that this package has built-in type declarations

    1.1.0 • Public • Published

    @hublaw/ofx-parser

    A light-weight Typescript Ofx Parser


    npm GitHub top language GitHub Release Date GitHub last commit GitHub

    A light weight Typescript tool that converts financial data from OFX into JS Object, applied only to Bank Account Statement developed and mantained by HubLaw and @gusflopes, and originally written by @bakesaled.


    🖋 Credits

    This tools depends on the xml2js package and started by a fork from @bakesaled/carbonate that did an awesome work mapping all the Ofx Structure to interfaces.


    🚧 Current Status

    This tool is still under development and missing tests, but it works as intendend.

    This package is currently being used on project under development.


    📝 Instructions

    There are two ways to use this use this package. You could use it as a dependency on your project to handle parsing OFX files. Or you can run it using the command line tool.

    Using this package on your project

    It's pretty straightforward, you just need to install this package and use the parseStatement() or parseStatementFile() functions from the OfxParser module.

    Create a Class to handle Ofx Files

    Basically you need to need to install the package:

    yarn add @hublawbr/ofx-parser

    After that you can create a class to Handle Ofx files:

    import OfxParser from '@hublaw/ofx-parser'
    
    export default class OfxHandler() {
      private ofxParser = new OfxParser()
      // Call this handler using a filePath from local file system
      // You could use this together with an upload route from Controller
      public async handler(filePath: string) {
        const result: StatementModel = await ofxParser.parseStatementFile(filePath)
        
        return result
      }
    }

    You don't really need a class just for that. Specially if using the parseStatementFile() instead of the parseStatement().

    The reason I personally prefer using it is because I do more stuff with the Ofx File, like: upload to GCloud Storage, persisting the transactions to bank, formatting specific fields like dates, download Ofx from GCloud, create signedUrl to share file, create readable stream from Gcloud instead of file system, and a few other stuff.

    Other use cases

    Suggestions would be appreciated, but you can see the examples folder

    Using as command line tool

    You can run this project as originally designed using a command tool. For that you want to clone the repository, and run the following commands:

    $ yarn install
    
    $ yarn start

    License

    MIT © HubLAW

    Install

    npm i @hublaw/ofx-parser

    DownloadsWeekly Downloads

    3

    Version

    1.1.0

    License

    MIT

    Unpacked Size

    141 kB

    Total Files

    28

    Last publish

    Collaborators

    • gusflopes