Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pablopunk/healthi-js
Simple npm module to get your PC's battery health
https://github.com/pablopunk/healthi-js
battery health javascript mac macbook-battery-health module node npm
Last synced: 20 days ago
JSON representation
Simple npm module to get your PC's battery health
- Host: GitHub
- URL: https://github.com/pablopunk/healthi-js
- Owner: pablopunk
- Created: 2017-01-08T23:17:45.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2019-01-17T07:44:50.000Z (almost 6 years ago)
- Last Synced: 2024-05-02T05:12:16.468Z (6 months ago)
- Topics: battery, health, javascript, mac, macbook-battery-health, module, node, npm
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/healthi
- Size: 237 KB
- Stars: 5
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# healthi
Simple module to get your PC's battery health
## Install
Right now it supports **mac** and **linux**:
```sh
npm install healthi
```## Usage
_Healthi_ works with promises since [version 2.0.0](https://github.com/pablopunk/healthi-js/releases/tag/2.0.0):
#### Example 1: await
```javascript
const health = require('healthi')
const battery = await health()
console.log(battery.health) //=> 90.76078670529044
```#### Example 2: then
```javascript
const health = require('healthi')
health()
.then(console.log) //=> { currentCapacity: 5953, originalCapacity: 6559, health: 90.76078670529044 }
.catch(console.log)
```## Result
The `battery` object has 3 attributes:
```js
{
now, // Example: 5953 mAh
original, // Example: 6559 mAh
health // Example: 90.7 % (this is the current capacity compared to the original one)
}
```## Contribute
[![JavaScript Style Guide](https://cdn.rawgit.com/feross/standard/master/badge.svg)](https://github.com/feross/standard)
Feel free to open an issue or a pull request
## Author
| ![me](https://www.gravatar.com/avatar/fa50aeff0ddd6e63273a068b04353d9d?s=100) |
| ----------------------------------------------------------------------------- |
| © 2017 [Pablo Varela](https://twitter.com/pablopunk) |