Last active
August 14, 2021 15:20
-
-
Save tygor/7a11dbe1838823e7cceda0635a77e3cb to your computer and use it in GitHub Desktop.
Convert Binary to Text in JS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function BinaryToText(inputString) { | |
return inputString | |
.replace(/\s/g,'') | |
.match(/.{1,8}/g) | |
.map( | |
function(byte) { | |
return String.fromCharCode(parseInt(byte,2)); | |
} | |
) | |
.join(''); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment