wifi-controller
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

Wifi Controller

NPM version Build Status License: MIT

wifi-controller is a Node.js module that allows you to manage Wi-Fi on and off states programmatically on macOS and Windows. It provides a simple API to turn Wi-Fi on, off, toggle the state, and restart the Wi-Fi adapter.

Table of Contents

Installation

You can install wifi-controller using npm:

npm install wifi-controller

Usage

Here is a simple example to demonstrate how to use wifi-controller:

const WifiController = require("wifi-controller");

(async () => {
  await WifiController.off();
  console.log("Wi-Fi is off");

  await WifiController.on();
  console.log("Wi-Fi is on");

  const name = await WifiController.device();
  console.log(`Wi-Fi device name: ${name}`);

  const isOn = await WifiController.isOn();
  console.log(`Wi-Fi is ${isOn ? "on" : "off"}`);
})();

API

WifiController

All methods return a Promise.

on()

Turns the Wi-Fi on.

off()

Turns the Wi-Fi off.

toggle(force)

Toggles the Wi-Fi state. Optionally pass a boolean to force a state.

restart()

Restarts the Wi-Fi (turns it off and then on).

isOn()

Returns a Promise indicating whether the Wi-Fi is on.

device()

Returns a Promise with the Wi-Fi device name.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Package Sidebar

Install

npm i wifi-controller

Weekly Downloads

4

Version

1.0.0

License

MIT

Unpacked Size

9.69 kB

Total Files

5

Last publish

Collaborators

  • vincenzomaritato