{"id":20896196,"url":"https://github.com/waitingsong/base64","last_synced_at":"2025-10-06T11:06:35.712Z","repository":{"id":70044778,"uuid":"190866082","full_name":"waitingsong/base64","owner":"waitingsong","description":"Base64 encoding, decoding on both modern browser and Node.js","archived":false,"fork":false,"pushed_at":"2020-03-03T07:35:19.000Z","size":855,"stargazers_count":9,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-25T14:18:21.945Z","etag":null,"topics":["base64","bigint","rfc4648","textdecoder","textencoder"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/waitingsong.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-06-08T08:52:43.000Z","updated_at":"2022-11-21T06:41:42.000Z","dependencies_parsed_at":"2023-03-16T08:15:20.659Z","dependency_job_id":null,"html_url":"https://github.com/waitingsong/base64","commit_stats":null,"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"purl":"pkg:github/waitingsong/base64","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/waitingsong%2Fbase64","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/waitingsong%2Fbase64/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/waitingsong%2Fbase64/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/waitingsong%2Fbase64/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/waitingsong","download_url":"https://codeload.github.com/waitingsong/base64/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/waitingsong%2Fbase64/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265595961,"owners_count":23794811,"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":["base64","bigint","rfc4648","textdecoder","textencoder"],"created_at":"2024-11-18T10:34:13.335Z","updated_at":"2025-10-06T11:06:35.652Z","avatar_url":"https://github.com/waitingsong.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# [base64](https://waitingsong.github.io/base64/)\n\nBase64 encoding/decoding in pure JS on both modern Browsers and Node.js based on [base64-js](https://www.npmjs.com/package/base64-js).  \nAlso supports [URL-safe base64](https://en.wikipedia.org/wiki/Base64#URL_applications)\n\n[![Version](https://img.shields.io/npm/v/@waiting/base64.svg)](https://www.npmjs.com/package/@waiting/base64)\n[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://opensource.org/licenses/MIT)\n![](https://img.shields.io/badge/lang-TypeScript-blue.svg)\n[![Build Status](https://travis-ci.org/waitingsong/base64.svg?branch=master)](https://travis-ci.org/waitingsong/base64)\n[![Build status](https://ci.appveyor.com/api/projects/status/wp4a72sj7bc5ao3t/branch/master?svg=true)](https://ci.appveyor.com/project/waitingsong/base64/branch/master)\n[![Coverage Status](https://coveralls.io/repos/github/waitingsong/base64/badge.svg?branch=master)](https://coveralls.io/github/waitingsong/base64?branch=master)\n[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org)\n\n\n## Features\n- Supports typeof `string`, `number` and [`bigint`](https://github.com/tc39/proposal-bigint)\n- Supports `ArrayBuffer` or `Uint8Array`\n- Encoding/Decoding via `TextEncoder`/`TextDecoder` under browser and `Buffer` under Node.js\n- Building various modules`ESM`, `UMD` and `CJS`\n\n\n## Browser requirement\n- Ability of [TextEncoder](https://developer.mozilla.org/en-US/docs/Web/API/TextEncoder#Browser_compatibility) and \n  [TextDecoder](https://developer.mozilla.org/en-US/docs/Web/API/TextDecoder#Browser_compatibility)\n- Polyfill [text-encoding](https://github.com/inexorabletash/text-encoding) for Edge\n\n\n## Node.js requirement\n- v10.4.0+ for `bigint` base64 encoding\n- [ICU](https://nodejs.org/api/util.html#util_whatwg_supported_encodings) installation for base64 decoding with char encodings other then `utf-8` and `utf-16le`\n\n\n## Installing\n```bash\nnpm install @waiting/base64\n```\n\n\n## Usage of Node.js\n\nSee the [Docs](https://waitingsong.github.io/base64/) for details\n\n### Encoding\n```ts\nimport { b64encode, b64fromBuffer, b64urlEncode } from '@waiting/base64'\n\nb64encode('A') === 'QQ=='\nb64encode('schöne') === 'c2Now7ZuZQ=='\nb64encode(1n) === b64encode(1) // bigint -\u003e 'MQ==' \nb64encode('𠮷') === b64encode('\\uD842\\uDFB7') === b64encode('\\u{20BB7}') // '8KCutw=='\n\nconst u8arr = Uint8Array.from([0xe4, 0xb8, 0xad, 0xe6, 0x96, 0x87])\nb64fromBuffer(u8arr) === b64encode('中文')  // '5Lit5paH'\n\n// URL-safe\nb64urlEncode('A') === 'QQ'\nb64urlEncode('中文测试') === '5Lit5paH5rWL6K-V'\n```\n\n### Decoding\n```ts\nimport { b64decode, b64urlDecode } from '@waiting/base64'\n\nb64decode('MQ==') === '1'\nb64urlDecode('MQ') === '1'\n```\n\n### Transfer\n```ts\nimport { b64toURLSafe, b64fromURLSafe } from '@waiting/base64'\n\n// base64 -\u003e URL-safe base64\nb64toURLSafe('QQ==') === 'QQ'\nb64toURLSafe('5Lit5paH5rWL6K+V') === '5Lit5paH5rWL6K-V'\n\n// URL-safe base64 -\u003e base64\nb64fromURLSafe('QQ') === 'QQ=='\nb64fromURLSafe('0J_RgNC40LLQtdGCLCDQvNC40YAh') === '0J/RgNC40LLQtdGCLCDQvNC40YAh'\n```\n\n\n## Usage of browser\n\nSee the [Docs](https://waitingsong.github.io/base64/) for details\n\n### ESM\n```html\n\u003cscript type=\"module\"\u003e\n  import { b64encode, b64urlEncode } from './base64.esm.min.js' \n  \n  console.log( b64encode('A') ) // 'QQ=='\n  console.log( b64urlEncode('A') )  // 'QQ'\n  console.log( b64encode('\\uD842\\uDFB7') ) // '8KCutw=='\n\u003c/script\u003e\n```\n\n### UMD\n```html\n\u003c!-- polyfill for Edge\n  Note: text-encoder-lite parse 4-bytes UTF-8 char incorrectly,\n  so use text-encoding instead.\n  see: https://github.com/solderjs/TextEncoderLite/issues/16\n--\u003e\n\u003c!--\n\u003cscript src=\"https://raw.githubusercontent.com/inexorabletash/text-encoding/master/lib/encoding-indexes.js\"\u003e\u003c/script\u003e\n\u003cscript src=\"https://raw.githubusercontent.com/inexorabletash/text-encoding/master/lib/encoding.js\"\u003e\u003c/script\u003e\n--\u003e\n\u003cscript src=\"./base64.umd.min.js\"\u003e\u003c/script\u003e\n\u003cscript\u003e\n  // global variable base64\n  console.log( base64.b64encode('A') )\n  console.log( base64.b64urlEncode('A') )\n  console.log( base64.b64encode('\\uD842\\uDFB7') )\n\u003c/script\u003e\n```\n\n\n## Testing\n```sh\nnpm run test\n\n# for browsers FireFox and Chrome\nnpm run test:browser\n\n# for browsers all available on this client\ncd .config \u0026\u0026 npm i\nnpm run browser:detect\n```\n\n\n## Demo\n- [Browser](https://github.com/waitingsong/base64/blob/master/test_browser/)\n- [Node.js](https://github.com/waitingsong/base64/blob/master/test/)\n\n\n## License\n[MIT](LICENSE)\n\n\n### Languages\n- [English](README.md)\n- [中文](README.zh-CN.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwaitingsong%2Fbase64","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwaitingsong%2Fbase64","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwaitingsong%2Fbase64/lists"}