{"id":18897132,"url":"https://github.com/boywithkeyboard-archive/bytes","last_synced_at":"2025-04-15T02:11:14.282Z","repository":{"id":98780901,"uuid":"608836913","full_name":"boywithkeyboard-archive/bytes","owner":"boywithkeyboard-archive","description":"A disk unit conversion library for JavaScript.","archived":false,"fork":false,"pushed_at":"2024-09-01T08:07:01.000Z","size":130,"stargazers_count":12,"open_issues_count":3,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-04-05T14:59:24.190Z","etag":null,"topics":["cjs","conversion","deno","esm","javascript","node","typescript"],"latest_commit_sha":null,"homepage":"https://npmjs.com/@boywithkeyboard/bytes","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/boywithkeyboard-archive.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},"funding":{"github":"boywithkeyboard"}},"created_at":"2023-03-02T20:52:58.000Z","updated_at":"2024-06-27T00:43:24.000Z","dependencies_parsed_at":"2024-01-05T00:26:44.323Z","dependency_job_id":"5ac0789e-c7ab-4815-8e45-d20a340288ed","html_url":"https://github.com/boywithkeyboard-archive/bytes","commit_stats":{"total_commits":68,"total_committers":3,"mean_commits":"22.666666666666668","dds":0.5147058823529411,"last_synced_commit":"400996400fdef4780fa16a51ff3e635d1274841f"},"previous_names":["boywithkeyboard/bytes","boywithkeyboard-archive/bytes"],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boywithkeyboard-archive%2Fbytes","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boywithkeyboard-archive%2Fbytes/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boywithkeyboard-archive%2Fbytes/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boywithkeyboard-archive%2Fbytes/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/boywithkeyboard-archive","download_url":"https://codeload.github.com/boywithkeyboard-archive/bytes/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248674976,"owners_count":21143761,"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":["cjs","conversion","deno","esm","javascript","node","typescript"],"created_at":"2024-11-08T08:36:26.345Z","updated_at":"2025-04-15T02:11:14.263Z","avatar_url":"https://github.com/boywithkeyboard-archive.png","language":"TypeScript","funding_links":["https://github.com/sponsors/boywithkeyboard"],"categories":[],"sub_categories":[],"readme":"## bytes\n\n### Setup\n\n#### Node.js\n\n```bash\nnpm i @boywithkeyboard/bytes\n```\n\n```ts\nimport { bytes } from '@boywithkeyboard/bytes'\n```\n\n#### Deno\n\n```ts\nimport { bytes } from 'https://esm.sh/@boywithkeyboard/bytes'\n```\n\n### Usage\n\n```ts\n/*\n * Convert bytes to a readable size.\n */\n\nbytes(100) // '100 B'\nbytes(25000) // '25 KB'\nbytes(50000000) // '50 MB'\nbytes(1000000000000) // '1 TB'\n\nbytes(100, { fmt: 'long' }) // '100 Bytes'\nbytes(25000, { fmt: 'long' }) // '25 Kilobytes'\nbytes(50000000, { fmt: 'long' }) // '50 Megabytes'\nbytes(1000000000000, { fmt: 'long' }) // '1 Terabyte'\n\n// Binary\n\nbytes(25 * 1024, { unit: 'binary' }) // '25 KiB'\nbytes(25 * 1024, { fmt: 'long', unit: 'binary' }) // '25 Kibibytes'\n\n/*\n * Convert a readable size to bytes.\n */\n\nbytes('100 B') // 100\nbytes('25 KB') // 25*1000\nbytes('50 MB') // 50*1000*1000\nbytes('1 TB') // 1000*1000*1000*1000\n\nbytes('100 Bytes') // 100\nbytes('25 Kilobytes') // 25*1000*1000\nbytes('50 Megabytes') // 50*1000*1000\nbytes('1 Terabyte') // 1000*1000*1000*1000\n\n// Binary\n\nbytes('25 Kibibytes') // 25*1024\nbytes('50 Mebibytes') // 50*1024*1024\nbytes('1 Tebibyte') // 1*1024*1024*1024\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fboywithkeyboard-archive%2Fbytes","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fboywithkeyboard-archive%2Fbytes","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fboywithkeyboard-archive%2Fbytes/lists"}