Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

NODEJS ES6 STRING TO BASE64

Encoding a string to base64
const buff = Buffer.from("hi readers", "utf8");
const base64 = buff.toString("base64");
console.log(base64); // aGkgcmVhZGVycw==

Decoding a base64 to a string
Similarly, we can decode a base64 encoding to a string like this.
const buff = Buffer.from("aGkgcmVhZGVycw==", "base64");
const str = buff.toString("utf8");
console.log(str); // hi readers
Source by reactgo.com #
 
PREVIOUS NEXT
Tagged: #NODEJS #STRING #TO
ADD COMMENT
Topic
Name
2+3 =