Answers for "convert binary file to text javascript"

1

converting binary to text js

function binaryAgent(str) {

var newBin = str.split(" ");
var binCode = [];

for (i = 0; i < newBin.length; i++) {
    binCode.push(String.fromCharCode(parseInt(newBin[i], 2)));
  }
return binCode.join("");
}
binaryAgent('01000001 01110010 01100101 01101110 00100111 01110100');
//translates to "Aren't"
Posted by: Guest on October-21-2020
1

convert text to binary javascript

function stringToBinary(str) {
    let strOut = "";
    for (var i = 0; i < str.length; i++) {
        strOut += str[i].charCodeAt(0).toString(2);
    }
    return strOut
}
Posted by: Guest on October-29-2021

Code answers related to "convert binary file to text javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language