Answers for "node base64 to buffer"

2

convert buffer to base64 javascript

var buffer = Buffer.from('hello');//create a buffer of the text "hello"
//right now, buffer == <Buffer 68 65 6c 6c 6f>
var string64 = buffer.toString('base64');
//the .toString operator can set encoding
//string64 == 'aGVsbG8='
Posted by: Guest on February-22-2021
1

buffer from base64

const b64string = /* whatever */;
const buf = Buffer.from(b64string, 'base64');
Posted by: Guest on October-28-2020
-2

Encoding and Decoding Base64 Strings in Node.js

'use strict';

let data = 'stackabuse.com';
let buff = new Buffer(data);
let base64data = buff.toString('base64');

console.log('"' + data + '" converted to Base64 is "' + base64data + '"');
Posted by: Guest on March-01-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language