node package manager

bluetooth

Get or set Bluetooth state.

bluetooth

Get or set Bluetooth state.

Currently OS X systems only

$ npm install --save bluetooth
const bluetooth = require('bluetooth');
 
bluetooth.isOn().then(state => {
    console.log(state);
    //=> false 
});
 
bluetooth.on().then(state => {
    console.log('Bluetooth state changed to on');
});
 
bluetooth.off().then(state => {
    console.log('Bluetooth state changed to off');
});
 
bluetooth.toggle().then(state => {
    console.log('Bluetooth state changed to on');
});
$ npm install --global bluetooth
$ bluetooth --help
 
  Example
    $ bluetooth
    $ bluetooth on
    $ bluetooth off

Check if bluetooth is on or off. Returns a promise for a boolean.

Turn bluetooth on. Returns a promise.

Turn bluetooth off. Returns a promise.

Toggle the bluetooth state. Returns a promise.

Type: boolean

Force a state when toggling.

MIT © Andreas Gillström