{"id":18980473,"url":"https://github.com/ecollect/taf-parser","last_synced_at":"2026-06-08T16:01:30.939Z","repository":{"id":95748908,"uuid":"158385647","full_name":"eCollect/taf-parser","owner":"eCollect","description":"TAF ( Tagged Format ) Sage 50 Format Parser.","archived":false,"fork":false,"pushed_at":"2018-11-21T17:41:29.000Z","size":170,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-11-11T16:10:42.357Z","etag":null,"topics":["lexer","parser","sage","sage50","stream","taf"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eCollect.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-11-20T12:23:42.000Z","updated_at":"2019-10-08T13:06:02.000Z","dependencies_parsed_at":"2023-05-21T21:15:10.346Z","dependency_job_id":null,"html_url":"https://github.com/eCollect/taf-parser","commit_stats":{"total_commits":13,"total_committers":2,"mean_commits":6.5,"dds":"0.23076923076923073","last_synced_commit":"cff902ab50eb136489958b88531668ad0c03d5e0"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/eCollect/taf-parser","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eCollect%2Ftaf-parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eCollect%2Ftaf-parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eCollect%2Ftaf-parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eCollect%2Ftaf-parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eCollect","download_url":"https://codeload.github.com/eCollect/taf-parser/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eCollect%2Ftaf-parser/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34069501,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-08T02:00:07.615Z","response_time":111,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["lexer","parser","sage","sage50","stream","taf"],"created_at":"2024-11-08T16:06:55.744Z","updated_at":"2026-06-08T16:01:30.865Z","avatar_url":"https://github.com/eCollect.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TAF parser\n\n'Tagged Format' (TAF) files are files that can be used to export and import data sets used by the accounting system of Sage 50 (more about this file format, supported tags and its specification can be found [here](https://github.com/eCollect/taf-parser/blob/master/docs/Sage50.TAF.Format.pdf)).\n\nThe parser goes through a string content or a stream of data and detects one error at a time in the structure.\n\n[![Build Status](https://travis-ci.org/eCollect/taf-parser.svg?branch=master)](https://travis-ci.org/eCollect/taf-parser) [![npm version](https://badge.fury.io/js/taf-parser.svg)](https://badge.fury.io/js/taf-parser) [![Coverage Status](https://coveralls.io/repos/github/eCollect/taf-parser/badge.svg?branch=master)](https://coveralls.io/github/eCollect/taf-parser?branch=master) [![Known Vulnerabilities](https://snyk.io/test/github/eCollect/taf-parser/badge.svg)](https://snyk.io/test/github/eCollect/taf-parser) [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](/eCollect/pateka/blob/master/LICENSE)\n\n## Installation\n\nTo install the parser, just type in your console:\n\n```shell\n$ npm install taf-parser\n```\n\n## Usage\n\nThis parser can be used to:  \n\n* **Parse a string**  \nIn this case it will return an array of objects that represents the data in the content upon success, or throw an error that shows what and where is the error happening. This method is recomended for small to midsize content that can be passed a string.  \nFor larger data use the stream capabilities.\n\n* **Parse a stream of data**  \nWhen dealing with large content it is recomended to use the parser to create a stream that can be combined with other streams. The stream pushes correctly parsed block of data down to the next stream. In case of an error, an `error` event is emited.\n\nFirst, require the parser:\n```javascript\nconst Parser = require('taf-parser');\n```\n\n### Parsing a string\n\n```javascript\nconst str = `\n    {Blg BlgNr=983984 GFNr=994885 Date=25.10.2017 Orig=0 MType=2\n    \t{Bk AccId=1022 Type=0 CAcc=div  ValNt=342.6  Text=\"Explain this some text\"}\n    }`;\nconst result = Parser.parse(str);\n```\n\nOr if you have a file:\n```javascript\nconst fs = require('fs');\nconst fileName = 'your_taf_file_name.taf';\nconst result = Parser.parse(fs.readFileSync(fileName, { encoding: 'utf8' }));\n```\n\nIn both cases, if the parser finds an error it will throw it, showing what is wrong and where it is located.\n\nIf there is no error, the result will be an array of objects, representing the data in the file. In the case of the example string given above, the result array will be as follows:\n```javascript\n[\n    {\n        type: 'Blg',\n        BlgNr: 983984,\n        GFNr: 994885,\n        Date: '2017-10-25T11:43:59.208Z',\n        Orig: 0,\n        MType: 2,\n        Bk: [\n            {\n                type: 'Bk',\n                AccId: '1022',\n                Type: 0,\n                CAcc: 'div',\n                ValNt: 342.6,\n                Text: 'Explain this some text'\n            }\n        ]\n    }\n]\n```\n\n\n### Parsing/Using streams\n\nTo use streams, just create parser stream like this:\n```javascript\nconst ParseStream = Parser.createStream();\n```\n\nThe newly created stream is a Transform stream, that expects data flowing to it and as a result pushes to the next stream javascript object representation of each successfully parsed block of data.  \nIn the case of an error the stream will emit an `error` event.\n\n**Streams example**\n```javascript\nconst fs = require('fs');\t\t\t// will use fs to create readabele file stream\nconst { Writable } = require('stream');\t\t// will use writable stream to collect all the data\n\nconst Parser = require('taf-parser');\t// require the Parser\n\nclass W extends Writable {\n\tconstructor() {\n\t\tsuper({ objectMode: true });\n\t\tthis.data = [];\n\t}\n\n\t_write(block, a, n) {\n\t\tthis.data.push(block);\n\t\tn();\n\t}\n}\n\nconst file = 'some_taf_file.taf';\nconst readStream = fs.createReadStream(file, { encoding: 'utf8' });\nconst Writer = new W();\nconst ParseStream = Parser.createStream();\t// create stream parser\n\nreadStream\n\t.pipe(ParseStream)\n\t.pipe(Writer);\n\n// you can listen for an 'error' event from ParseStream\nParseStream.on('error', (error) =\u003e {\n\tconsole.log(error);\n});\n\n// and 'finish' from the Writer where all the data is collected\nWriter.on('finish', () =\u003e {\n\t// Writer.data holds all the data\n\tconsole.log(Writer.data); // or do something else\n});\n```\n\n## Licensing\n\nCopyright (c) 2018 eCollect AG.\nLicensed under the [MIT](LICENSE) license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fecollect%2Ftaf-parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fecollect%2Ftaf-parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fecollect%2Ftaf-parser/lists"}