Files
30-seconds-of-code/snippets/btoa.md
Isabelle Viktoria Maciohsek 8bf67754ce Make expertise a field
2022-03-01 20:21:45 +02:00

546 B

title, tags, expertise, firstSeen, lastUpdated
title tags expertise firstSeen lastUpdated
Encode string to Base64 node,string beginner 2018-01-17T21:43:21+02:00 2020-09-15T16:28:04+03:00

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 Buffer for the given string with binary encoding.
  • Use Buffer.prototype.toString() to return the base-64 encoded string.
const btoa = str => Buffer.from(str, 'binary').toString('base64');
btoa('foobar'); // 'Zm9vYmFy'