0

I have 256 character string each character is 1 or 0 and I need to convert it to base64 how to do this?

mark820850
  • 123
  • 1
  • 11
  • 2
    `btoa(string)` ;) – Sebastian Kaczmarek Feb 12 '20 at 13:25
  • Will this work as expected though? Because each character in op's string represents a bit and with `btoa()` "each character in the string is treated as a byte of binary data" https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/btoa – JDunken Feb 12 '20 at 13:43

1 Answers1

0

var your256bitstring;

// Base 64 encoded
var b64 = btoa(your256bitstring);

// :)
Lorza
  • 459
  • 8
  • 23