# binary-info

> Native node module to get the platform and architecture of a binary

Latest version **0.1.0** (published 2023-01-13) · MIT license · 0 weekly downloads

## Install

```sh
npm install binary-info
pnpm add binary-info
yarn add binary-info
bun add binary-info
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2023-01-13 |
| First published | 2021-11-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >= 10.16.0 |
| Dependencies | 0 |
| Unpacked size | 4.6 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 6 |
| Maintainers | timfish |
| Keywords | binary, parser, platform, arch, elf, pe, mach-o |

## Links

- npm: https://www.npmjs.com/package/binary-info
- Repository: https://github.com/timfish/binary-info
- Homepage: https://github.com/timfish/binary-info#readme
- Issues: https://github.com/timfish/binary-info/issues
- npm.io page: https://npm.io/package/binary-info

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 0.1.0 (latest) — 2023-01-13
- 0.0.5 — 2023-01-13
- 0.0.3 — 2021-11-22
- 0.0.2 — 2021-11-19
- 0.0.1 — 2021-11-15

## README

# `binary-info`

Native node module to get the platform and architecture of a binary

```ts
const binary = require('binary-info');

// getInfo will throw an error if the file does not appear to be
// a binary or is an unknown architecture
binary.getInfo('./path/to/some-binary');
// {
//    platform: "darwin",
//    arches: ["x64", "arm64"] 
// }
// arches is an array to support getting multiple architectures from Mac Fat binaries

// isCompatible will return true if the file is a binary
// and the binary support the supplied platform and architecture
binary.isCompatible('./path/to/some.node', 'darwin', 'x64');
// false
binary.isCompatible('./non-binary.js', 'darwin', 'x64');
// false

// isIncompatible will return true if the file is a binary
// but the binary does not support the supplied platform and architecture
binary.isIncompatible('./path/to/some.node', 'darwin', 'x64');
// true
binary.isIncompatible('./non-binary.js', 'darwin', 'x64');
// false
```

| Platform | Arch    | Binary Included | Detected | CI Tested |
| -------- | ------- | --------------- | -------- | --------- |
| `win32`  | `x64`   | ✔️              | ✔️       | ✔️        |
| `win32`  | `ia32`  | ✔️              | ✔️       | ✔️        |
| `win32`  | `arm64` | ✔️              | ✔️       |           |
| `darwin` | `x64`   | ✔️              | ✔️       | ✔️        |
| `darwin` | `arm64` | ✔️              | ✔️       |           |
| `linux`  | `x64`   | ✔️              | ✔️       | ✔️        |
| `linux`  | `arm64` | ✔️              | ✔️       |           |
| `linux`  | `arm`   | ✔️              | ✔️       |           |

## All the hard work by:

- [`napi-rs`](https://github.com/napi-rs/napi-rs) - Rust to Node-API bindings
- [`goblin`](https://github.com/m4b/goblin) - Rust library to parse binaries

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