{"id":22222022,"url":"https://github.com/fabiospampinato/base256-encoding","last_synced_at":"2025-08-05T22:33:22.175Z","repository":{"id":60785307,"uuid":"395805291","full_name":"fabiospampinato/base256-encoding","owner":"fabiospampinato","description":"Base256 encoding, the most memory-efficient encoding possible in JavaScript.","archived":false,"fork":false,"pushed_at":"2025-01-25T18:48:19.000Z","size":1226,"stargazers_count":24,"open_issues_count":0,"forks_count":0,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-07-13T22:03:17.469Z","etag":null,"topics":["base256","encoding"],"latest_commit_sha":null,"homepage":null,"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/fabiospampinato.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},"funding":{"github":"fabiospampinato","custom":"https://www.paypal.me/fabiospampinato"}},"created_at":"2021-08-13T21:44:51.000Z","updated_at":"2025-03-31T19:24:44.000Z","dependencies_parsed_at":"2024-06-19T13:43:23.613Z","dependency_job_id":"7743db33-bc16-4ac9-986b-12e224bdcd63","html_url":"https://github.com/fabiospampinato/base256-encoding","commit_stats":{"total_commits":26,"total_committers":1,"mean_commits":26.0,"dds":0.0,"last_synced_commit":"0af5cd5e06315698dca70584a85be2f9fd4f8d1c"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/fabiospampinato/base256-encoding","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabiospampinato%2Fbase256-encoding","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabiospampinato%2Fbase256-encoding/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabiospampinato%2Fbase256-encoding/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabiospampinato%2Fbase256-encoding/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fabiospampinato","download_url":"https://codeload.github.com/fabiospampinato/base256-encoding/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabiospampinato%2Fbase256-encoding/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266775334,"owners_count":23982271,"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","status":"online","status_checked_at":"2025-07-23T02:00:09.312Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"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":["base256","encoding"],"created_at":"2024-12-02T23:16:34.580Z","updated_at":"2025-07-24T01:03:15.538Z","avatar_url":"https://github.com/fabiospampinato.png","language":"JavaScript","funding_links":["https://github.com/sponsors/fabiospampinato","https://www.paypal.me/fabiospampinato"],"categories":[],"sub_categories":[],"readme":"# Base256\n\nBase256 encoding, a.k.a. latin1 encoding, the most memory-efficient encoding possible in JavaScript.\n\n## Features\n\nIf a string contains only the 256 codepoints from `\\u0000` to `\\u00ff` then in modern engine it will consume one byte of memory per character. If that's not true then two (!) bytes of memory per character will be consumed, even if only one character goes out of range. Base64 falls within the golden range but it only uses 25% of the available codepoints, Base256 uses all of them and is therefore more memory efficient.\n\nIf you need the encoded string to be URL-friendly or something or if you are encoding tiny things you should go with Base64, otherwise using Base256 will save you a decent amount of memory.\n\n## Install\n\n```sh\nnpm install base256-encoding\n```\n\n## Usage\n\n```ts\nimport Base256 from 'base256-encoding';\n\n// Uint8Array encoding \u0026 decoding\n\n{\n  const raw = 'Hello 😃';\n  const uint8 = new TextEncoder ().encode ( raw );\n  console.log ( uint8 ); // =\u003e Uint8Array(10) [ 72, 101, 108, 108, 111,  32, 240, 159, 152, 131 ]\n\n  const encoded = Base256.encode ( uint8 );\n  console.log ( encoded ); // =\u003e 'Hello ð\\x9F\\x98\\x83'\n\n  const decoded = Base256.decodeStr ( encoded );\n  console.log ( decoded ); // =\u003e // =\u003e Uint8Array(10) [ 72, 101, 108, 108, 111,  32, 240, 159, 152, 131 ]\n}\n\n// String encoding \u0026 decoding\n\n{\n  const raw = 'Hello 😃';\n  const encoded = Base256.encodeStr ( raw );\n  console.log ( encoded ); // =\u003e 'Hello ð\\x9F\\x98\\x83'\n\n  const decoded = Base256.decodeStr ( encoded );\n  console.log ( decoded ); // =\u003e 'Hello 😃'\n}\n\n// Check if a string is base256-encoded\n\n{\n  console.log ( Base256.is ( 'Hello' ) ); // =\u003e true\n  console.log ( Base256.is ( '😃' ) ); // =\u003e false\n}\n```\n\n## License\n\nMIT © Fabio Spampinato\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffabiospampinato%2Fbase256-encoding","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffabiospampinato%2Fbase256-encoding","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffabiospampinato%2Fbase256-encoding/lists"}