Skip to content

Latest commit

 

History

History
41 lines (31 loc) · 1.82 KB

File metadata and controls

41 lines (31 loc) · 1.82 KB

Cross-platform hardware identifier collector that gathers system information (BIOS, board, CPU, GPU, storage, memory) for Linux environments, with special handling for Raspberry Pi and DMI-based systems.

Key Components

  • linux_identifiers() — Main function that reads hardware data from /sys/class/dmi/id, /proc/cpuinfo, and various system utilities. Detects Raspberry Pi vs. standard DMI platforms.
  • trimIdentifiers(val) — Strips null, empty, or 'None' values from identifier objects.
  • trimResults(val) — Removes private (_-prefixed) keys and falsy values from result arrays.
  • brief(headers, obj) — Filters result objects to only include specified header keys.
  • dataHandler(c) — Stdout data accumulator callback used with child process streams.

Usage Example

// Retrieve hardware identifiers on a Linux system
var computerIdentifiers = require('computer-identifiers');

var info = computerIdentifiers.linux_identifiers();

console.log(info.identifiers);
// {
//   bios_vendor: 'American Megatrends Inc.',
//   board_name: 'Z590 AORUS ULTRA',
//   cpu_name: 'Intel(R) Core(TM) i9-11900K',
//   gpu_name: ['NVIDIA Corporation GA102 [RTX 3090]'],
//   ...
// }

console.log(info.linux.memory);
// Memory slots parsed from dmidecode output

console.log(info.linux.volumes);
// Filesystem volumes from df -T output

Notes

  • Requires system binaries: lspci, lshw, df, dmidecode (optional), and vcgencmd (Raspberry Pi only).
  • Falls back to lscpu if /proc/cpuinfo returns no CPU model.
  • Memory details are enriched via dmidecode when available (DMI types 5, 6, 16, 17).
  • Part of the MeshAgent core module system, registered via addModule('computer-identifiers', ...).