Skip to content

NicholasMata/pitect

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pitect travis npm downloads

NodeJS module used for detecting if node project is running on a Raspberry Pi.

Features

  • Detect if node project is running on a Raspberry Pi.
  • Detect the specific Raspberry Pi model.
  • Get the serial number of a Raspberry Pi

Install

npm install pitect --save

Usage

Javascript

const pitect = require('pitect');

if(pitect.isPi()) {
    console.log('This is a Raspberry Pi.');
    console.log('This is: ' + pitect.piModel().name);
    console.log('Raspberry Pi Serial Number: ' + pitect.serialNumber());
    if (pitect.piModel() == pitect.MODELS.PI_A) {
        console.log('This is a Raspberry PI Model A');
    }
}

Typescript

import * as pitect from 'pitect';

if(pitect.isPi()) {
    console.log('This is a Raspberry Pi.');
    console.log('This is: ' + pitect.piModel().name);
    console.log('Raspberry Pi Serial Number: ' + pitect.serialNumber());
    if (pitect.piModel() == pitect.MODELS.PI_A) {
        console.log('This is a Raspberry PI Model A');
    }
}