{"id":13462287,"url":"https://github.com/dankogai/js-base64","last_synced_at":"2025-09-09T21:14:43.270Z","repository":{"id":536204,"uuid":"165557","full_name":"dankogai/js-base64","owner":"dankogai","description":"Base64 implementation for JavaScript","archived":false,"fork":false,"pushed_at":"2025-08-10T14:17:02.000Z","size":379,"stargazers_count":4334,"open_issues_count":11,"forks_count":1312,"subscribers_count":70,"default_branch":"main","last_synced_at":"2025-09-04T06:46:41.869Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"Wikidata/Wikidata-Toolkit","license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dankogai.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2009-04-01T21:15:08.000Z","updated_at":"2025-09-03T07:13:34.000Z","dependencies_parsed_at":"2024-02-21T14:48:23.630Z","dependency_job_id":"49845cf5-3371-434f-b1ec-a68a7b72db62","html_url":"https://github.com/dankogai/js-base64","commit_stats":{"total_commits":343,"total_committers":47,"mean_commits":7.297872340425532,"dds":0.3294460641399417,"last_synced_commit":"df91b05e36b3bed8efdbd5db7cf2769b57c80669"},"previous_names":[],"tags_count":69,"template":false,"template_full_name":null,"purl":"pkg:github/dankogai/js-base64","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dankogai%2Fjs-base64","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dankogai%2Fjs-base64/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dankogai%2Fjs-base64/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dankogai%2Fjs-base64/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dankogai","download_url":"https://codeload.github.com/dankogai/js-base64/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dankogai%2Fjs-base64/sbom","scorecard":{"id":321070,"data":{"date":"2025-08-11","repo":{"name":"github.com/dankogai/js-base64","commit":"5fd183de18040eda8fd59a0bd3098d7f3e6938d0"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":5.6,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Maintained","score":6,"reason":"8 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 6","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Code-Review","score":1,"reason":"Found 4/26 approved changesets -- score normalized to 1","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":9,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Info: jobLevel 'contents' permission set to 'read': .github/workflows/node.js.yml:17","Warn: jobLevel 'security-events' permission set to 'write': .github/workflows/node.js.yml:18","Warn: no topLevel permission defined: .github/workflows/node.js.yml:1"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Security-Policy","score":10,"reason":"security policy file detected","details":["Info: security policy file detected: SECURITY.md:1","Info: Found linked content: SECURITY.md:1","Info: Found disclosure, vulnerability, and/or timelines in security policy: SECURITY.md:1","Info: Found text in security policy: SECURITY.md:1"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/node.js.yml:23: update your workflow using https://app.stepsecurity.io/secureworkflow/dankogai/js-base64/node.js.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/node.js.yml:24: update your workflow using https://app.stepsecurity.io/secureworkflow/dankogai/js-base64/node.js.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/node.js.yml:27: update your workflow using https://app.stepsecurity.io/secureworkflow/dankogai/js-base64/node.js.yml/main?enable=pin","Warn: npmCommand not pinned by hash: .github/workflows/node.js.yml:37","Info:   0 out of   3 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   1 npmCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE.md:0","Info: FSF or OSI recognized license: BSD 3-Clause \"New\" or \"Revised\" License: LICENSE.md:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'main'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 8 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-18T01:22:39.951Z","repository_id":536204,"created_at":"2025-08-18T01:22:39.951Z","updated_at":"2025-08-18T01:22:39.951Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273695695,"owners_count":25151583,"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-09-04T02:00:08.968Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","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":[],"created_at":"2024-07-31T12:00:43.789Z","updated_at":"2025-09-09T21:14:43.262Z","avatar_url":"https://github.com/dankogai.png","language":"JavaScript","funding_links":[],"categories":["Uncategorized","JavaScript"],"sub_categories":["Uncategorized"],"readme":"[![CI via GitHub Actions](https://github.com/dankogai/js-base64/actions/workflows/node.js.yml/badge.svg)](https://github.com/dankogai/js-base64/actions/workflows/node.js.yml)\n\n# base64.js\n\nYet another [Base64] transcoder.\n\n[Base64]: http://en.wikipedia.org/wiki/Base64\n\n## Install\n\n```shell\n$ npm install --save js-base64\n```\n\n## Usage\n\n### In Browser\n\nLocally…\n\n```html\n\u003cscript src=\"base64.js\"\u003e\u003c/script\u003e\n```\n\n… or Directly from CDN.  In which case you don't even need to install.\n\n```html\n\u003cscript src=\"https://cdn.jsdelivr.net/npm/js-base64@3.7.8/base64.min.js\"\u003e\u003c/script\u003e\n```\n\nThis good old way loads `Base64` in the global context (`window`).  Though `Base64.noConflict()` is made available, you should consider using ES6 Module to avoid tainting `window`.\n\n### As an ES6 Module\n\nlocally…\n\n```javascript\nimport { Base64 } from 'js-base64';\n```\n\n```javascript\n// or if you prefer no Base64 namespace\nimport { encode, decode } from 'js-base64';\n```\n\nor even remotely.\n\n```html\n\u003cscript type=\"module\"\u003e\n// note jsdelivr.net does not automatically minify .mjs\nimport { Base64 } from 'https://cdn.jsdelivr.net/npm/js-base64@3.7.8/base64.mjs';\n\u003c/script\u003e\n```\n\n```html\n\u003cscript type=\"module\"\u003e\n// or if you prefer no Base64 namespace\nimport { encode, decode } from 'https://cdn.jsdelivr.net/npm/js-base64@3.7.8/base64.mjs';\n\u003c/script\u003e\n```\n\n### node.js (commonjs)\n\n```javascript\nconst {Base64} = require('js-base64');\n```\n\nUnlike the case above, the global context is no longer modified.\n\nYou can also use [esm] to `import` instead of `require`.\n\n[esm]: https://github.com/standard-things/esm\n\n```javascript\nrequire=require('esm')(module);\nimport {Base64} from 'js-base64';\n```\n\n## SYNOPSIS\n\n```javascript\nlet latin = 'dankogai';\nlet utf8  = '小飼弾'\nlet u8s   =  new Uint8Array([100,97,110,107,111,103,97,105]);\nBase64.encode(latin);             // ZGFua29nYWk=\nBase64.encode(latin, true);       // ZGFua29nYWk skips padding\nBase64.encodeURI(latin);          // ZGFua29nYWk\nBase64.btoa(latin);               // ZGFua29nYWk=\nBase64.btoa(utf8);                // raises exception\nBase64.fromUint8Array(u8s);       // ZGFua29nYWk=\nBase64.fromUint8Array(u8s, true); // ZGFua29nYW which is URI safe\nBase64.encode(utf8);              // 5bCP6aO85by+\nBase64.encode(utf8, true)         // 5bCP6aO85by-\nBase64.encodeURI(utf8);           // 5bCP6aO85by-\n```\n\n```javascript\nBase64.decode(      'ZGFua29nYWk=');// dankogai\nBase64.decode(      'ZGFua29nYWk'); // dankogai\nBase64.atob(        'ZGFua29nYWk=');// dankogai\nBase64.atob(        '5bCP6aO85by+');// 'å°é£¼å¼¾' which is nonsense\nBase64.toUint8Array('ZGFua29nYWk=');// u8s above\nBase64.decode(      '5bCP6aO85by+');// 小飼弾\n// note .decodeURI() is unnecessary since it accepts both flavors\nBase64.decode(      '5bCP6aO85by-');// 小飼弾\n```\n\n```javascript\nBase64.isValid(0);      // false: 0 is not string\nBase64.isValid('');     // true: a valid Base64-encoded empty byte\nBase64.isValid('ZA=='); // true: a valid Base64-encoded 'd'\nBase64.isValid('Z A='); // true: whitespaces are okay\nBase64.isValid('ZA');   // true: padding ='s can be omitted\nBase64.isValid('++');   // true: can be non URL-safe\nBase64.isValid('--');   // true: or URL-safe\nBase64.isValid('+-');   // false: can't mix both\n```\n\n### Built-in Extensions\n\nBy default `Base64` leaves built-in prototypes untouched.  But you can extend them as below.\n\n```javascript\n// you have to explicitly extend String.prototype\nBase64.extendString();\n// once extended, you can do the following\n'dankogai'.toBase64();        // ZGFua29nYWk=\n'小飼弾'.toBase64();           // 5bCP6aO85by+\n'小飼弾'.toBase64(true);       // 5bCP6aO85by-\n'小飼弾'.toBase64URI();        // 5bCP6aO85by- ab alias of .toBase64(true)\n'小飼弾'.toBase64URL();        // 5bCP6aO85by- an alias of .toBase64URI()\n'ZGFua29nYWk='.fromBase64();  // dankogai\n'5bCP6aO85by+'.fromBase64();  // 小飼弾\n'5bCP6aO85by-'.fromBase64();  // 小飼弾\n'5bCP6aO85by-'.toUint8Array();// u8s above\n```\n\n```javascript\n// you have to explicitly extend Uint8Array.prototype\nBase64.extendUint8Array();\n// once extended, you can do the following\nu8s.toBase64();     // 'ZGFua29nYWk='\nu8s.toBase64URI();  // 'ZGFua29nYWk'\nu8s.toBase64URL();  // 'ZGFua29nYWk' an alias of .toBase64URI()\n```\n\n```javascript\n// extend all at once\nBase64.extendBuiltins()\n```\n\n## `.decode()` vs `.atob` (and `.encode()` vs `btoa()`)\n\nSuppose you have:\n\n```\nvar pngBase64 = \n  \"iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=\";\n```\n\nWhich is a Base64-encoded 1x1 transparent PNG, **DO NOT USE** `Base64.decode(pngBase64)`.  Use `Base64.atob(pngBase64)` instead.  `Base64.decode()` decodes to UTF-8 string while `Base64.atob()` decodes to bytes, which is compatible to browser built-in `atob()` (Which is absent in node.js).  The same rule applies to the opposite direction.\n\nOr even better, `Base64.toUint8Array(pngBase64)`.\n\n## Brief History\n\n* Since version 3.3 it is written in TypeScript.  Now `base64.mjs` is compiled from `base64.ts` then `base64.js` is generated from `base64.mjs`.\n* Since version 3.7 `base64.js` is ES5-compatible again (hence IE11-compatible).\n* Since 3.0 `js-base64` switch to ES2015 module so it is no longer compatible with legacy browsers like IE (see above)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdankogai%2Fjs-base64","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdankogai%2Fjs-base64","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdankogai%2Fjs-base64/lists"}