Skip to content

Instantly share code, notes, and snippets.

@tygor
Last active August 14, 2021 15:20
Show Gist options
  • Save tygor/7a11dbe1838823e7cceda0635a77e3cb to your computer and use it in GitHub Desktop.
Save tygor/7a11dbe1838823e7cceda0635a77e3cb to your computer and use it in GitHub Desktop.
Convert Binary to Text in JS
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