{"id":16358717,"url":"https://github.com/hertzg/node-xhb","last_synced_at":"2026-03-15T16:38:53.883Z","repository":{"id":34820709,"uuid":"183915496","full_name":"hertzg/node-xhb","owner":"hertzg","description":"(somewhat) Sane library to parse and serialize HomeBank XHB files (databases).","archived":false,"fork":false,"pushed_at":"2025-03-01T18:41:07.000Z","size":106079,"stargazers_count":5,"open_issues_count":2,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-13T05:35:39.747Z","etag":null,"topics":["homebank","nodejs","parse","parser","serialize","serializer","typescript","xhb","xml"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hertzg.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2019-04-28T14:01:01.000Z","updated_at":"2024-08-16T22:10:30.000Z","dependencies_parsed_at":"2023-02-19T06:31:02.730Z","dependency_job_id":"226d500b-edd6-4897-b4b9-aaa9e8921838","html_url":"https://github.com/hertzg/node-xhb","commit_stats":{"total_commits":290,"total_committers":6,"mean_commits":"48.333333333333336","dds":0.506896551724138,"last_synced_commit":"089d72c6f53ae92726ecf195992c0af6e200ddf7"},"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hertzg%2Fnode-xhb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hertzg%2Fnode-xhb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hertzg%2Fnode-xhb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hertzg%2Fnode-xhb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hertzg","download_url":"https://codeload.github.com/hertzg/node-xhb/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244094267,"owners_count":20397020,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["homebank","nodejs","parse","parser","serialize","serializer","typescript","xhb","xml"],"created_at":"2024-10-11T02:06:32.952Z","updated_at":"2026-03-15T16:38:48.813Z","avatar_url":"https://github.com/hertzg.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# XHB file read/write for NodeJS\n\nThis package provides ability to read and modify xhb files created by HomeBank in somewhat sane manner.\n\n[HomeBank](http://homebank.free.fr/) is a personal finance and money management software application built and\nmaintained by Maxime Doyen.\n\n## Command Line Usage\nThis package also includes a tiny cli utility `xhb` to convert between `.xhb` and `.json` formats\n\n```bash\n# Convert XHB to JSON\n$ npx xhb parse \u003c database.xhb \u003e database.json\n\n# Modify the database with common tools, just keep structure the same\n$ mv database.json database-modified.json\n\n# Convert JSON back to XHB\n$ npx xhb serialize \u003c database-modified.json \u003e database-modified.xhb\n```\n\n## Programmatic Usage\n\n```bash\n$ npm install xhb --save\n```\n\n```typescript\nimport FS from 'fs'\nimport { parse, serialize } from 'xhb'\n\nconst contents = FS.readFileSync('./homebank.xhb', { encoding: 'utf8' })\nconst xhb = parse(contents)\n\n// modify / copy / clone the xhb object, whatever you need to do with it.\n\nconst modified = serialize(xhb)\nFS.writeFileSync('./homebank-modified.xhb', modified, { encoding: 'utf8' })\n```\n\n## API overview\n\nAs the original code is using GLib types, following aliases are used to map to javascript types\n\n```typescript\nexport type gShort = number\nexport type gUShort = number\nexport type gInt = number\nexport type gUInt32 = number\nexport type gCharP = string\nexport type gDouble = string // For airthmetic operations, consider using decimal.js\nexport type gBoolean = number // https://developer.gnome.org/glib/stable/glib-Basic-Types.html#gboolean\n```\n\n### XHB File structure\n\n```typescript\nexport interface XHB {\n  versions: Versions\n  properties?: Properties\n  accounts: Account[]\n  archives: Archive[]\n  assigns: Assign[]\n  categories: Category[]\n  currencies: Currency[]\n  operations: Operation[]\n  payees: Payee[]\n  tags: Tag[]\n}\n```\n\nFor more information, please see type definitions for respective entities from source code.\n\n### FAQ\n\nHere are some questions that come up or most likely will come up.\n\n##### Dates are in weird format, how do I convert them to js Dates?\n\nThe dates are in GLib specific julian day format (which is not \"real\" julian day count). Consider using\npackage [`gdate-julian`](https://github.com/hertzg/node-gdate-julian) package.\n\n---\n\n##### All the amounts are parsed as `strings` not `numbers`. Why?\n\nAll amounts in HomBank are handled as `gdoubles` in C, here are a few reasons why I went with strings in javascript:\n\n- There is no double type in javascript\n- It's out of the scope of this project\n- Using `floats` (`number`) would not be able to fit all values\n- The values in XML are strings so you can parse them as you see fit.\n\nRecommendation:\nConsider using decimal.js package to work with `gdoubles` It will save you quite a lot of headache.\n\n---\n\n##### Tags is always empty, even thou I've added tags to operations. Whats up with that?\n\nHomeBank does not create them separately in XML. This package reads and write the XHB file as it is.\n\n---\n\n##### The XML produced is not \"correct\" xml and why do you use `sprintf` to create xml tags? That's stupid!\n\nThis is the way HomeBank deals with XML files. Don't believe me? Check the source code on launchpad. The goal of this\nproject is to be able to read and write files acceptable by that application so I mimic the way it deals with the file\nformat.\n\nSee: [https://bazaar.launchpad.net/~mdoyen/homebank/5.2.x/view/head:/src/hb-xml.c#L1214](https://bazaar.launchpad.net/~mdoyen/homebank/5.2.x/view/head:/src/hb-xml.c#L1214)\n\n---\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhertzg%2Fnode-xhb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhertzg%2Fnode-xhb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhertzg%2Fnode-xhb/lists"}