Skip to content

Instantly share code, notes, and snippets.

@hideack
Created January 11, 2021 06:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hideack/80bf5b4897172d2f6a4edd06900f3316 to your computer and use it in GitHub Desktop.
Save hideack/80bf5b4897172d2f6a4edd06900f3316 to your computer and use it in GitHub Desktop.
'use strict';
const execa = require('execa');
const plist = require('simple-plist');
(async () => {
const {stdout} = await execa('ioreg', ['-k', 'BatteryPercent', '-r', '-a']);
let data = plist.parse(stdout);
console.log(data);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment