mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
14 lines
340 B
TypeScript
14 lines
340 B
TypeScript
import * as base64 from 'base-64';
|
|
import * as utf8 from 'utf8';
|
|
|
|
let text = 'foo © bar 𝌆 baz';
|
|
let bytes = utf8.encode(text);
|
|
let encoded = base64.encode(bytes);
|
|
// → 'Zm9vIMKpIGJhciDwnYyGIGJheg=='
|
|
|
|
encoded = 'Zm9vIMKpIGJhciDwnYyGIGJheg==';
|
|
bytes = base64.decode(encoded);
|
|
text = utf8.decode(bytes);
|
|
|
|
const version = base64.version;
|