431 B
431 B
title, tags
| title | tags |
|---|---|
| btoa | node,string,beginner |
Creates a base-64 encoded ASCII string from a String object in which each character in the string is treated as a byte of binary data.
- Create a
Bufferfor the given string with binary encoding and useBuffer.toString('base64')to return the encoded string.
const btoa = str => Buffer.from(str, 'binary').toString('base64');
btoa('foobar'); // 'Zm9vYmFy'