btoa() 1

btoa()

const decode = (value) =>Buffer.from(value, 'base64').toString()

Here is what the above code is Doing:
1. We’re importing the Buffer module from Node.js.
2. We’re creating a function called encode that takes a value as a parameter.
3. We’re converting the value to a base64 string using the toString(‘base64’) function.
4. We’re creating a function called decode that takes a value as a parameter.
5. We’re converting the value from a base64 string to a UTF-8 string using the toString(‘utf8’) function.

Similar Posts