Files
30-seconds-of-code/snippets/atob.md
Isabelle Viktoria Maciohsek 27c168ce55 Bake date into snippets
2021-06-13 13:55:00 +03:00

19 lines
445 B
Markdown

---
title: atob
tags: node,string,beginner
firstSeen: 2018-01-17T21:43:21+02:00
lastUpdated: 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 and use `Buffer.toString('binary')` to return the decoded string.
```js
const atob = str => Buffer.from(str, 'base64').toString('binary');
```
```js
atob('Zm9vYmFy'); // 'foobar'
```