Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

osx-bluetooth

gillstrom47MIT3.0.0

Get or set Bluetooth state on OS X systems

apple, blue, bluetooth, bt, osx, tooth

readme

osx-bluetooth Build Status

Get or set Bluetooth state on OS X systems

Install

$ npm install --save osx-bluetooth

Usage

const osxBluetooth = require('osx-bluetooth');

osxBluetooth.isOn().then(state => {
    console.log(state);
    //=> false
});

osxBluetooth.on().then(() => {
    console.log('Bluetooth state changed to on');
});

osxBluetooth.off().then(() => {
    console.log('Bluetooth state changed to off');
});

osxBluetooth.toggle().then(() => {
    console.log('Bluetooth state changed to on');
});

API

.isOn()

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

.on()

Turn bluetooth on. Returns a promise.

.off()

Turn bluetooth off. Returns a promise.

.toggle([force])

Toggle the bluetooth state. Returns a promise.

force

Type: boolean

Force a state when toggling.

CLI

See the bluetooth CLI.

License

MIT © Andreas Gillström