Wednesday, September 20, 2023
HomeJavascriptInscribe base64 in JavaScript - Understanding JS

Inscribe base64 in JavaScript – Understanding JS


Aug 11, 2023.

The most convenient method to transform a string to base64 is utilizing the international btoa() feature as adheres to.

 btoa(' hey there'); 

btoa() is sustained in all contemporary internet browsers and also Node.js >>= 16.0.0
Considered that Node.js 14 was EOL in April 2023, you need to make use of indigenous btoa() to transform strings to base64, unless you require to sustain older internet browsers or older Node.js variations.

btoa() is well sustained in internet browsers, yet is a fairly brand-new enhancement to Node.js.
Fortunately, you can likewise make use of Node.js barriers to transform strings to base64 utilizing barriers’ toString() technique as adheres to.

 const buf = Buffer.from(' hey there', ' utf8');.
buf.toString(' base64'); 

Even More Basics Tutorials

RELATED ARTICLES

Most Popular

Recent Comments