@veloxapp/abab
v1.0.0
Published
Reliable Cross-Platform ATOB/BTOA
Downloads
6
Readme
@veloxapp/abab
Reliable, cross-environment ATOB and BTOA conversion. Inspired by the deprecated abab library.
Installation
pnpm i @veloxapp/abab
Usage
import { atob, btoa } from '@veloxapp/abab'; // the atob/btoa exports will use per-platform implementations, falling back to the pure implementation
console.log(atob('SGVsbG8gV29ybGQ=')); // Hello World
console.log(btoa('Hello World')); // SGVsbG8gV29ybGQ=
Using Pure Implementation
If you want to always use the pure-js implementation, rather than opting for the (likely more performant) native platform implementations where possible, you can import it directly:
import { Base64 } from '@veloxapp/abab';
const base64 = new Base64(); // you can also use the lowercase `base64` export, which is what the `atob` and `btoa` exports use when the native implementations are unavailable
License
This package, unlike the other components of Velox, is dual-licensed under the MIT License. For more information, please see the LICENSE file.