0.1.0 • Published 1 year ago

binary-info v0.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

binary-info

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

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
PlatformArchBinary IncludedDetectedCI Tested
win32x64✔️✔️✔️
win32ia32✔️✔️✔️
win32arm64✔️✔️
darwinx64✔️✔️✔️
darwinarm64✔️✔️
linuxx64✔️✔️✔️
linuxarm64✔️✔️
linuxarm✔️✔️

All the hard work by:

  • napi-rs - Rust to Node-API bindings
  • goblin - Rust library to parse binaries