0.0.2 • Published 7 years ago

binarystring v0.0.2

Weekly downloads
3
License
Apache-2.0
Repository
github
Last release
7 years ago

install

npm install binarystring --save

Convert integer to binary string

byInt8(int_number)

byInt16(int_number)

byInt32(int_number)

Convert binary string to integer

toInt8(8bit_binary_string)

toInt16(16bit_binary_string)

toInt32(32bit_binary_string)

Exmaple

const { toInt32, byInt32, byInt16, toInt16, toInt8, byInt8 } = require("binarystring");

console.log(byInt8(113));   // 01110001
console.log(byInt16(113));  // 00000000 01110001
console.log(byInt32(113));  // 00000000 00000000 00000000 01110001

console.log(toInt8("01110001"));   // 113
console.log(toInt16("00000000 01110001"));   // 113
console.log(toInt32("00000000 00000000 00000000 01110001"));   // 113

License

Apache License 2.0