1.0.12 • Published 2 years ago

@keepcoding/bin v1.0.12

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Bin

The Bin is a simple node js library to convert string to binary and binary to string.

How to use

import bin

const bin = require("@keepcoding/bin");

Convert string into Binary

// for space between every byte
const gap = true;

const binary = bin.binary("hello" , gap);

console.log(binary);

// output will be
// 01101000 01100101 01101100 01101100 01101111

Convert binary to String

const string = bin.string("0110100001100101011011000110110001101111");

console.log(binary);

// output will be
// hello

Prettify your Binary

const text = "Hello World";
/* 
    skip used to decide how many skips will be there,
    deafult value of skip is 8
*/
const skip = 8;
/*
    symbol decides which symbol will be used between,
    default value of symbol is " "
*/
const symbol = " ";
let binary = bin.gap(text , skip , symbol);

/*
    Output
    "01001000 01100101 01101100 01101100 01101111 00100000 
    01010111 01101111 01110010 01101100 01100100"
*/
1.0.12

2 years ago

1.0.11

2 years ago

1.0.10

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago