How to use 'btoa javascript' in JavaScript

Every line of 'btoa javascript' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
6function btoa(str) {
7 let buffer;
9 if (str instanceof Buffer) {
10 buffer = str;
11 } else {
12 buffer = new Buffer(str.toString(), 'binary');
13 }
15 return buffer.toString('base64');

Related snippets