1.5.0 • Published 4 years ago

pirev v1.5.0

Weekly downloads
3
License
MIT
Repository
github
Last release
4 years ago

pirev

npm version license

A tiny, zero-dependency utility providing hardware revision information for Raspberry Pi devices. All information is parsed from the device's revision code located in /proc/cpuinfo.

Installation

yarn add pirev

or

npm install pirev

Usage

Asynchronous

const pirev = require('pirev');

pirev.getInfo().then(({ revision }) => {
  console.log(`Raspberry Pi ${revision.type}`);
});

Synchronous

const pirev = require('pirev');

const { revision } = pirev.getInfoSync();

console.log(`Raspberry Pi ${revision.type}`);

Error handling

Running the utility on a device which is not a Raspberry Pi will result in an error being thrown.

pirev.getInfo()
  .then(({ revision }) => console.log(`Raspberry Pi ${revision.type}`))
  .catch(() => console.warn('Not a Raspberry Pi device!'));

or

try {
  const { revision } = pirev.getInfoSync();
  console.log(`Raspberry Pi ${revision.type}`);
} catch {
  console.warn('Not a Raspberry Pi device!');
}
1.5.0

4 years ago

1.4.0

4 years ago

1.3.0

5 years ago

1.2.1

5 years ago

1.2.0

5 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.1

6 years ago

1.0.0

6 years ago