binary-tools.js

  • Support bfloat16, float16 and more
  • Support integers from 8 to 1024-bit and more
  • Support UTF-8, UTF-16 and UTF-32 strings
  • Zero dependencies
  • Fully tested

Download the latest release:

binary-tools-1.12.0.tgz CC-BY-NC-ND-4.0 SHA-1: e78d9ab8c9377047e8dac9d00662048bb04c0550 MD5: be30dcf95c6acf8fb43b9f159ba8f44f

Dealing with bytes should be a pleasure.

binary-tools.js eases the task of dealing with raw binary data by using a simple interface built upon conventions you are likely to be already familiar with and a extensive list of real-world types.

Free in the true sense of free software.

This software is available under a range of open-source licenses - meaning that after buying it you can have full access to its source code and deal with it with all the freedom granted by those licenses, including developing it yourself and sharing your work with the world.

Not just your vanilla 16-bit integers.

Modern applications need way more than the common types supported by standard libraries - binary-tools.js have native support for huge integers, not-so-common types used in media files, novel data types used in AI development and cryptic types used on legacy software and hardware - all using the same codebase.

binary-tools.js is built for safety and speed, with a API that suits both reading and writing a few bytes of structured data or huge streams of bytes, as in the case of media files.

It works everywhere.

While the source code of this software is developed using the latest patterns and features of present-day JavaScript, it is built so that it may be compiled/transpiled to work in any environment with JavaScript support, including extremely outdated engines like IE6.

No black-box approach.

binary-tools.js relies on standard math (and some bit shifting) to perform all of its operations. It is blazing fast, safe and clear on its approach to reading and writing binary data. All parsers are stand-alone classes that perform their tasks using clear language, well defined steps and very little language-specific features (or none at all), meaning that you can always be absolutely sure about whats going on under the hood, and also that porting any of its functionality to other languages or environments, for example, should be as easy as copying, pasting and changing the syntax.

Tested to exhaustion.

There is no such thing as "enough" when it comes to testing. No release comes until the source code is 100% tested - lines, functions, branches, everything must be 100%. If I'm able to test all possible inputs, I'll do it. If I'm not able to test all possible inputs, I'll sample the most inputs I can, always using diverse and reliable sources. Adding tests is a continuous process, and if a bug is found I'm proud to show both the bug and the bugfix to the world.




The fastest binary parser for JavaScript.

LGPL version available

binary-tools: JavaScript binary tools for any browser or environment.
Copyright (C) 2023 Rafael da Silva Rocha

This software is released under the Creative Commons CC-BY-NC-ND-4.0 license (very restrictive, no commercial use). You may purchase a version of this software released under more permissive open source licenses for your freedom and convenience.

For commercial use:

  • Buy now: $10.00  | CC-BY-ND-4.0

    No sources included, licensed as CC-BY-ND-4.0 for commercial use.

Full source code:

  • Buy now: $40.00  | GPL

    Comes multi-licensed with GPL-2.0 and GPL-3.0

  • Buy now: $80.00  | LGPL

    Comes multi-licensed with LGPL-2.1, LGPL-3.0, MPL-2.0 and GPLs

Multi-licensing ensures that you can choose the license that works best for you.

Licenses apply to specific versions.

Last reviewed in 2025-02-09


Talk to me: [email protected]

I may be available to work on your project.