Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

decode-encode-binary

A Module/CLI to encode & decode binary numbers

decode, encode, binary to text, text to binary, cli

readme

decode-encode-binary

A Module/CLI to encode & decode binary numbers

GitHub repo size Total Downloads Line

Installation

Using npm
$ npm install decode-encode-binary
Using Yarn
$ yarn add decode-encode-binary

Using in Terminal

  • The Terminal command is encdec or decenc (both function the same)
  • Using in Terminal requires to have package installed with the --global tag
    $ encdec
    $ > Enter your input (Binary/Text)
    $ > Hi
    $ 0100100001101001
    $ decenc
    $ > Enter your input (Binary/Text)
    $ > 0100100001101001
    $ Hi

Examples

An example of decoding text from binary numbers

const test = require("decode-encode-binary");
test.decode("0100100001100101011011000110110001101111");

// output: "Hello"

An example of encoding text to binary numbers

const test = require("decode-encode-binary");
test.encode("Hello");

// output: "0100100001100101011011000110110001101111"
  • A binary letter padding can be used by setting boolean as the second parameter `js const test = require("decode-encode-binary"); test.encode("Hi", true);

// output: "01001000 01101001"


#### An example of using `determine`
```js
const test = require("decode-encode-binary");

test.determine("Hi");
// output: 0100100001101001

test.determine("0100100001101001");
// output: "Hi"

Try on Runkit Star On GitHub Fork On GitHub Line