{"id":18204636,"url":"https://github.com/shesek/fmtbtc","last_synced_at":"2025-04-02T13:32:01.027Z","repository":{"id":57239465,"uuid":"125457873","full_name":"shesek/fmtbtc","owner":"shesek","description":"Format and convert bitcoin's display units (msat, sat, bit, milli and btc)","archived":false,"fork":false,"pushed_at":"2018-03-17T00:31:17.000Z","size":61,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-24T00:09:20.869Z","etag":null,"topics":["bit","bitcoin","bitcoin-units","bits","btc","milli","millis","msat","msatoshi","sat","satoshi"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shesek.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-03-16T03:22:09.000Z","updated_at":"2020-12-04T21:39:17.000Z","dependencies_parsed_at":"2022-08-30T00:11:21.355Z","dependency_job_id":null,"html_url":"https://github.com/shesek/fmtbtc","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shesek%2Ffmtbtc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shesek%2Ffmtbtc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shesek%2Ffmtbtc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shesek%2Ffmtbtc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shesek","download_url":"https://codeload.github.com/shesek/fmtbtc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246823858,"owners_count":20839786,"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":["bit","bitcoin","bitcoin-units","bits","btc","milli","millis","msat","msatoshi","sat","satoshi"],"created_at":"2024-11-03T11:05:00.921Z","updated_at":"2025-04-02T13:32:00.698Z","avatar_url":"https://github.com/shesek.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# fmtbtc\n\nFormat and convert bitcoin's display units (`msat`, `sat`, `bit`, `milli` and `btc`).\n\nOperates on the numbers as strings using [move-decimal-point](https://github.com/shesek/move-decimal-point)\n(the only dependency), so that it doesn't require a library for arbitrary-precision arithmetic.\n\nThe browserify bundle (including the `move-decimal-point` dependency) weights 1,781 bytes when minified\nor 868 bytes when gzipped.\n\n## Install\n\n```bash\n$ npm install fmtbtc\n```\n\n## Use\n\n```js\n// common case: convert from satoshis to btc\nimport fmtbtc from 'fmtbtc'\nfmtbtc(100000000) // =\u003e 1\nfmtbtc(100000005000) // =\u003e 1000.0005\n\n// pretty print with commas separator\nfmtbtc(100000005000, true) // =\u003e 1,000.0005\n\n// with other base/target units\nimport { msat2milli, milli2msat } from 'fmtbtc'\nmsat2milli(100000000) // =\u003e 1\nmilli2msat(1, true) // =\u003e 100,000,000\n\n// with dynamic unit names via fmt()/pfmt()\nimport { fmt, pfmt } from 'fmtbtc'\nfmt(1, 'milli', 'sat') // =\u003e 100000\npfmt(1, 'milli', 'sat') // =\u003e 100,000\n```\n\nUsing the browserify bundle (available at `dist/fmtbtc.bundle.min.js`),\nwhich exposes the library at `window.fmtbtc`:\n\n```html\n\u003cscript src=\"fmtbtc.bundle.min.js\"\u003e\u003c/script\u003e\n\u003cscript\u003e\nfmtbtc(100000000) // =\u003e 1\nfmtbtc.sat2milli(100000) // =\u003e 1\n\u003c/script\u003e\n```\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshesek%2Ffmtbtc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshesek%2Ffmtbtc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshesek%2Ffmtbtc/lists"}