Skip to content

JavaScript library to convert any String to Binary Code and vice-versa

Notifications You must be signed in to change notification settings

s-faisal/str2bin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

String to Binary

JavaScript library / CLI commands to convert any String to Binary Code and vice-versa.

Installation

To install via npm

npm i str2bin

To install via yarn

yarn add str2bin

Usage

const str2bin = require("str2bin")
str2bin.strToBin(string) 
str2bin.binToStr(binaryCode, delimiter) 

str2bin.strToBin("hello") 
## returns "01101000 01100101 01101100 01101100 01101111"

str2bin.binToStr("01101000 01100101 01101100 01101100 01101111") 
## returns "hello"

str2bin.binToStr("01101000-01100101-01101100-01101100-01101111", "-") 
## returns "hello"

Command line usage

Install the package globally

npm i -g str2bin ##using NPM 
OR
yarn global add str2bin ##using yarn
## str2bin -s "string_that_needs_to_be_converted"
str2bin -s "hello"
## returns "01101000 01100101 01101100 01101100 01101111"

## str2bin -b "binary_string_that_needs_to_be_converted"
str2bin -b "01101000 01100101 01101100 01101100 01101111"
## returns 'hello'

## str2bin -b "binary_string_that_needs_to_be_converted" -d "delimiter"
str2bin -b "01101000-01100101-01101100-01101100-01101111" -d "-"
## returns "hello"

About

JavaScript library to convert any String to Binary Code and vice-versa

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published