pci-id-parser
Version:
A small library to parse a PCI ID database into a JS Object or find a specific device.
68 lines (50 loc) • 1.44 kB
Markdown
A small library to parse a [PCI ID database](https://raw.githubusercontent.com/pciutils/pciids/master/pci.ids) into a JS Object or find a specific device.
Inspired by [pci-ids](https://www.npmjs.com/package/pci-ids) ♥
```bash
$ npm install pci-id-parser
```
```js
// Parse text PCI ID database to JS Object
parse_pci_list({file = "STRING"})
// Find the device using provided information
find_pci_device({
vendor_id : "10DE",
device_id : "1E81",
subvendor_id : "10DE",
subdevice_id : "13A0",
file : raw_data
})
/*
{
vendor: 'NVIDIA Corporation',
device: 'TU104 [GeForce RTX 2080 SUPER]',
subdevice: 'UNKNOWN',
subvendor: 'NVIDIA Corporation'
}
*/
// Find the device using provided information
find_pci_device_via_key({
device_key : "Enum\PCI\VEN_10DE&DEV_1E81&SUBSYS_13A010DE&REV_A1",
file : raw_data
})
/*
{
vendor: 'NVIDIA Corporation',
device: 'TU104 [GeForce RTX 2080 SUPER]',
subdevice: 'UNKNOWN',
subvendor: 'NVIDIA Corporation'
}
*/
```
```bash
$ npm install
$ npm run get-list -- -- --json
import pci from 'path_to_file/pci-list.js'
```