
Company News
Socket Has Acquired Secure Annex
Socket has acquired Secure Annex to expand extension security across browsers, IDEs, and AI tools.
var binary = require('s-binary');
binary.toInt('11001100'); // returns 204
// 8bit 5 - 9
var five = binary.toBinary(5, 8); // '00000101'
var nine = binary.toBinary(9, 8); // '00001001'
var negativeNine = binary.complement(nine); // '11110111'
var sum = binary.add(five, negativeNine); // '11111100'
var checkAnswer = binary.complement(sum); // '00000100'
binary.toInt(checkAnswer); // 4
npm install --save s-binary
This module assumes big-endian byte order
binary.toInt('11001100'); // returns 204
binary.toHex('11001100'); // returns 'cc'
binary.toUnicode('0110100001101001'); // returns 'hi'
binary.toBinary(204); // returns '11001100'
binary.toBinary('foo'); // returns '011001100110111101101111'
binary.add('111', '1'); // returns '1000'
binary.addBits('1', '1'); // returns ['0', '1']
// ------------------------------- sum ^ -- ^ carry
binary.multiply('1010', '10'); // returns '10100'
// 10 ^ 2 ^ 20 ^
binary.divide('1010', '101'); // returns '10'
// 10 ^ 5 ^ 2 ^
binary.not('1011'); // returns '0100'
binary.and('101', '110'); // returns '100'
binary.or('101', '110'); // returns '111'
binary.xor('101', '110'); // returns '011'
binary.nand('101', '110'); // returns '011'
binary.nor('101', '110'); // returns '000'
binary.complement('00000101'); // returns '11111011'
binary.pad('01', 4); // returns '0001' (left pad)
binary.equalize('11', '0001'); // returns ['0011', '0001']
binary.split('1111111100000000', 8); // returns ['11111111', '00000000']
Last bit from each byte. Note: bytes can be of any length.
var data = ['01000100', '11001100', '01010101'];
binary.lsb(data); // returns '001'
FAQs
Simple operations for binary strings
The npm package s-binary receives a total of 8 weekly downloads. As such, s-binary popularity was classified as not popular.
We found that s-binary demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Socket has acquired Secure Annex to expand extension security across browsers, IDEs, and AI tools.

Research
/Security News
Socket is tracking cloned Open VSX extensions tied to GlassWorm, with several updated from benign-looking sleepers into malware delivery vehicles.

Product
Reachability analysis for PHP is now available in experimental, helping teams identify which vulnerabilities are actually exploitable.