Expand my Community achievements bar.

Join us for Adobe Campaign Community Q&A Coffee Break on Thursday, March 7th at 8am PT with Eric Perrin, Gael Mouello, Chakravarthy Kalva, Bruce Swann and Sandra Hausmann.
SOLVED

How to decode from a Base64 string in javascrip node?

Avatar

Level 2

How to decrypt a string that is Base64 in Javascript (Adobe camapign classic)

Ex: 
var Base64 = ''Qr1hU3Zdk/2m+k6UA+KpE="

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hello @thomaso34696569 

try below red text.

 

var memBuff = new MemoryBuffer();
memBuff.fromString('dummy text');
var textBase64 = memBuff.toBase64();
logInfo(textBase64);

 

var memBuff2 = new MemoryBuffer();
memBuff2.appendBase64(textBase64);
var text = memBuff2.toString();
logInfo(text);

 

memBuff.dispose();
memBuff2.dispose();

View solution in original post

1 Reply

Avatar

Correct answer by
Community Advisor

Hello @thomaso34696569 

try below red text.

 

var memBuff = new MemoryBuffer();
memBuff.fromString('dummy text');
var textBase64 = memBuff.toBase64();
logInfo(textBase64);

 

var memBuff2 = new MemoryBuffer();
memBuff2.appendBase64(textBase64);
var text = memBuff2.toString();
logInfo(text);

 

memBuff.dispose();
memBuff2.dispose();