Skip to content

kenany/battery-remaining

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

battery-remaining

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

Example

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

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

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

Installation

$ npm install battery-remaining

API

const 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.