raspberrypi-sys-info
v0.3.0
Published
A Node.js library to retrieve system information (temperature, memory usage, disk activity, etc.) from a Raspberry Pi. This library wraps system calls in Node.js using Typescript for easy access to Raspberry Pi's hardware stats
Downloads
10
Maintainers
Readme
Raspberry PI System Info
This project is an npm library for extracting various metrics from Raspberry Pi.
Table of Contents
Installation
To use this library in your project, you need to install it via npm. Make sure you have Node.js and npm installed.
npm i raspberrypi-sys-info
Usage
Below is an example of how to use the library to fetch and display various metrics from a Raspberry Pi.
Example Code
import { getCpuTemperature, getGpuTemperature } from 'raspberrypi-sys-info';
async function displaySystemInfo() {
try {
const cpuTemp = await getCpuTemperature();
console.log(`CPU Temperature: ${cpuTemp}°C`);
const gpuTemp = await getGpuTemperature();
console.log(`GPU Temperature: ${gpuTemp}°C`);
} catch (error) {
console.error(error.message);
}
}
displaySystemInfo();
Functions
getCPUTemperature()
Returns the CPU temperature in degrees Celsius.
getGpuTemperature()
Returns the GPU temperature in degrees Celsius.
Contributing
Contributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes.
- Fork the repository.
- Create a new branch (
git checkout -b feature-branch
). - Make your changes.
- Commit your changes (
git commit -m 'Add some feature'
). - Push to the branch (
git push origin feature-branch
). - Open a pull request.
License
This project is licensed under the MIT License.