Files
30-seconds-of-code/snippets/js/s/decode-base64-encoded-string.md
Angelos Chalaris 9d032ce05e Rename js snippets
2023-05-19 20:23:47 +03:00

476 B

title, type, language, tags, cover, dateModified
title type language tags cover dateModified
Decode Base64 encoded string snippet javascript
node
string
thread 2020-09-15T16:28:04+03:00

Decodes a string of data which has been encoded using base-64 encoding.

  • Create a Buffer for the given string with base-64 encoding.
  • Use Buffer.prototype.toString() to return the decoded string.
const atob = str => Buffer.from(str, 'base64').toString('binary');
atob('Zm9vYmFy'); // 'foobar'