battery-remaining

Get the remaining charge in a battery

Usage no npm install needed!

<script type="module">
  import batteryRemaining from 'https://cdn.skypack.dev/battery-remaining';
</script>

README

battery-remaining

Dependency Status

Get the remaining charge in a battery. Probably only works on Linux.

Example

var batteryRemaining = require('battery-remaining');

batteryRemaining('BAT0', function(error, charge) {
  if (error) {
    throw error;
  }

  console.log(charge);
  // => 21.88
});

Installation

$ npm install battery-remaining

API

var batteryRemaining = require('battery-remaining');

batteryRemaining([battery='BAT0'], callback)

Calls callback(error, remaining), where error is any Error encountered and Number remaining is the charge remaining in String battery in watts.