Installing Base64
Node.js
npm install @hexagon/base64 --save
JavaScript:
// ESM Import
import base64 from "@hexagon/base64";
// ... or CommonJS Require
const base64 = require("@hexagon/base64");
TypeScript:
Note: In Node.js TypeScript, only the default export is available as the commonjs module is used internally.
import base64 from "@hexagon/base64";
// ...
Deno
JavaScript:
import base64 from "https://deno.land/x/b64@1.1.28/src/base64.js";
// ...
TypeScript:
import { base64 } from "https://deno.land/x/b64@1.1.28/src/base64.js";
// ...
Browser
Manual
- Download the latest zipball.
- Unpack.
- Grab
base64.min.js
(UMD and standalone) orbase64.min.mjs
(ES-module) from the dist/ folder.
CDN
For a UMD-module (standalone, RequireJS, etc.):
<script src="https://cdn.jsdelivr.net/npm/@hexagon/base64@1/dist/base64.min.js"></script>
As an ES-module:
<script type="module">
import base64 from "https://cdn.jsdelivr.net/npm/@hexagon/base64@1/dist/base64.min.mjs";
// ... see 'Usage' section ...
</script>