
Company News
Socket Named Top Sales Organization by RepVue
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.
Converts a bin array to an (Intel) HEX string. More specifically I8HEX since only record types 00 and 01 are being used.
Can be used in both nodeJs and Browser context, you only need to supply the binary data in form of a Uint8Array:
import BinToHex from "bin-to-hex";
const data = new Uint8Array([0xDE, 0xAD, 0xBE, 0xEF]);
const converter = new BinToHex();
const hex = converter.convert(data);
console.log(hex)
Alternatively you can pass configuration to the consturctur, the following values are assumed to be the defaults if you do not instantiate with parameters:
import BinToHex from "bin-to-hex";
const maxBytes = 10;
const offset = 0;
const empty = null;
const converter = new BinToHex(maxBytes, offset, empty);
Those parameters additionally have setters and getters:
converter.setMaxBytes(4);
converter.getMaxBytes();
0x000xFF after bein erased, the hex file does not need to include those segments of memory, reducing the overall file size of the HEX file.You can provide the binary data to the convert methods in different ways, for example by reading a local file or converting a Blob to a Buffer.
Each line in a HEX file represents a chunk of data at a specific address:
:{RCLEN}{ADDRESS}{RECTYPE}{DATA}{CHECKSUM}
Every HEX file ends with a 01 (End of file) record.
The binary representation of 0xDEADBEEF would end up in the following HEX file representation:
:04 0000 00 DEADBEEF
yarn install
yarn lint
yarn test
yarn build
Lint, test and build
yarn pre-publish
and finally publish to NPM
yarn publish
In order to use the library locally it needs to be linked like so:
yarn linkyarn buildyarn link "bin-to-hex"Then you can import and use the library:
import BinToHex from 'bin-to-hex';
const data = new Uint8Array([0xDE, 0xAD, 0xBE, 0xEF]);
const converter = new BinToHex();
const hex = converter.convert(data);
console.log(hex);
Contributions are very welcome, please direct your PRs against the develop branch.
FAQs
Convert BIN data to HEX string
The npm package bin-to-hex receives a total of 17 weekly downloads. As such, bin-to-hex popularity was classified as not popular.
We found that bin-to-hex 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 won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.