b64-lite
Version:
isomorphic base64 library in 152 bytes
36 lines (23 loc) • 729 B
Markdown
isomorphic base64 library in 152 bytes
```javascript
const b64 = require('b64-lite');
// Base64 in ASCII to byte string
b64.atob('aGkgdGhlcmU=');
// hi there
// byte string to Base64 in ASCII
b64.btoa('hi there');
// aGkgdGhlcmU=
b64.toBase64('hello 你好');
// aGVsbG8g5L2g5aW9
b64.fromBase64('aGVsbG8g5L2g5aW9');
// hello 你好
```
If you use ES6 imports with a bundler that supports tree-shaking, yes!
```javascript
import { toBase64 } from 'b64-lite'
```
MIT