binarystring
v0.0.2
Published
var binaryString = int32ToBinaryString(-12345); // 11111111 11111111 11001111 11000111
Downloads
2
Readme
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