# binary-version-reader

> If you're building firmware on the Particle Platform, you might be curious to see the metadata stored in your firmware! This module will read any metadata stored in the various modules (bootloader, system, user), and help you understand any dependencies.

Latest version **4.2.0** (published 2026-05-01) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install binary-version-reader
pnpm add binary-version-reader
yarn add binary-version-reader
bun add binary-version-reader
```

Provides the command `pmod`.

## Health

**Score 50/100 (C)** — status: active.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

## Facts

| | |
|---|---|
| Version | 4.2.0 |
| Published | 2026-05-01 |
| First published | 2015-12-09 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Node | >=12 |
| Dependencies | 6 |
| Unpacked size | 1.6 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | suda, monkbroc, avtolstoy, particlebot |

## Links

- npm: https://www.npmjs.com/package/binary-version-reader
- npm.io page: https://npm.io/package/binary-version-reader

## Dependencies (6)

- [xtend](https://npm.io/package/xtend.md) ^4.0.2
- [archiver](https://npm.io/package/archiver.md) ^5.3.1
- [unzipper](https://npm.io/package/unzipper.md) ^0.10.11
- [tmp-promise](https://npm.io/package/tmp-promise.md) ^3.0.3
- [buffer-crc32](https://npm.io/package/buffer-crc32.md) ^0.2.5
- [@particle/device-os-protobuf](https://npm.io/package/@particle/device-os-protobuf.md) ^2.7.0

## Recent versions

- 4.2.0 (latest) — 2026-05-01
- 4.0.1-rc.1 (beta) — 2026-03-10
- 4.1.0 — 2026-04-14
- 4.0.2 — 2026-03-11
- 4.0.1 — 2026-03-11
- 4.0.0 — 2026-01-30
- 3.1.3 — 2025-12-16
- 3.1.2 — 2025-12-04
- 3.1.1 — 2025-12-02
- 3.1.0 — 2025-12-01
- 3.0.2 — 2025-08-28
- 3.0.1 — 2025-07-31
- 2.5.2 — 2024-12-09
- 2.5.1 — 2024-10-15
- 2.5.0 — 2024-10-10
- … 35 more at https://npm.io/package/binary-version-reader/versions

## README

# The Particle Binary Version Reader!

If you're building firmware on the Particle Platform, you might be curious to see the metadata stored in your firmware!  This module will read any metadata stored in the various modules (bootloader, system, user), and help you understand any dependencies.

[![Build Status](https://github.com/particle-iot/binary-version-reader/actions/workflows/ci.yaml/badge.svg)](https://github.com/particle-iot/binary-version-reader/actions)



## Usage

```js
    const Reader = require('binary-version-reader').HalModuleParser;
    const reader = new Reader();
    reader.parseFile('your_binary.bin', function(fileInfo, err) {
        console.log(fileInfo);
    });
```

You can also inspect a firmware binary from the command line without installing the package:

```
npx binary-version-reader your_binary.bin
```

The output is valid JSON, suitable for piping into other tools:

```
npx binary-version-reader your_binary.bin | jq '.prefixInfo.moduleVersion'
```

## Example output

```json
{
  "filename": "your_binary.bin",
  "crc": {
    "ok": true,
    "storedCrc": "b138f375",
    "actualCrc": "b138f375"
  },
  "prefixInfo": {
    "moduleStartAddy": "80a0000",
    "moduleEndAddy": "80a128c",
    "reserved": 0,
    "moduleFlags": 0,
    "moduleVersion": 2,
    "platformID": 6,
    "moduleFunction": 5,
    "moduleIndex": 1,
    "depModuleFunction": 4,
    "depModuleIndex": 2,
    "depModuleVersion": 1,
    "dep2ModuleFunction": 0,
    "dep2ModuleIndex": 0,
    "dep2ModuleVersion": 0,
    "prefixSize": 24,
    "prefixOffset": 0
  },
  "suffixInfo": {
    "productId": -1,
    "productVersion": -1,
    "fwUniqueId": "f9f552aa98d7e3eab750862a01743024a4d05514021598a4341b3d83b37eda36",
    "reserved": 0,
    "suffixSize": 36,
    "crcBlock": "b138f375"
  }
}
```


## Testing firmware binaries

When you need to create a firmware binary for an integration test, you
can use the provided `firmwareTestHelper` instead of relying on fixtures
in your application.

```
const { firmwareTestHelper, ModuleInfo } = require('binary-version-reader');
const binary = firmwareTestHelper.createFirmwareBinary({ productId: 123, productVersion: 6, platformId: 10, deps: [ { func: ModuleInfo.FunctionType.SYSTEM_PART, index: 1, version: 1210 } ] });
```

## Releasing changes

Packages are only released from the `master` branch after peer review.

1. make sure you have the latest:
	* `$ git checkout master`
	* `$ git pull`
2. make sure tests pass
	* `$ npm test`
3. bump the version
	* `$ npm version <major|minor|patch>`
4. push your tags:
	* `$ git push origin main --follow-tags`

---
_Source: https://npm.io/package/binary-version-reader · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
