npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

wpa-ctrl

v1.1.2

Published

wpa wifi controller

Readme

WpaCtrl

WpaCtrl to control wpa_supplicant

npm install wpa-ctrl --save

This only works on linux, tested on Debian stretch. You need to have wpa_supplicant installed and run as a user in the netdev group.

For more examples, see the test directory for p2p and wifi connection samples. This is a very basic library, it is nessary to write another wrapper over this.

Kind: global class
Emits: WpaCtrl#event:raw_msg, WpaCtrl#event:response, WpaCtrl#event:CTRL-REQ, WpaCtrl#event:P2P-DEVICE-FOUND, WpaCtrl#event:P2P-DEVICE-LOST, WpaCtrl#event:P2P-GROUP-STARTED, WpaCtrl#event:P2P-INVITATION-RECEIVED, WpaCtrl#event:CTRL-EVENT-CONNECTED, WpaCtrl#event:CTRL-EVENT-DISCONNECTED
See: http://w1.fi/wpa_supplicant/devel/ctrl_iface_page.html for full documentation of the commands that can be sent and events that can be emitted.

new WpaCtrl(ifName, [ctrlPath])

constructs WpaCtrl

| Param | Type | Default | Description | | --- | --- | --- | --- | | ifName | string | | interface name eg. wlan0 | | [ctrlPath] | string | "'/run/wpa_supplicant'" | The location of the wpa_supplicant control interface. |

Example (Scan for SSIDs and connect to an wireless network.)

'use strict';

const WpaCtrl = require('wap-ctrl');
let wpa = new WpaCtrl('wlan0');

wpa.on('raw_msg', function(msg) {
    console.log(msg);
});

wpa.connect().then(function () {
    console.log('ready');

    return wpa.listNetworks();
}).then(function (networks) {
    console.log(networks);

    return wpa.scan();
}).then(function (accessPoints) {
    console.log(accessPoints);

    wpa.addNetwork();
    wpa.setNetworkSSID(0, 'ssid');
    wpa.setNetworkPreSharedKey(0, 'password');
    wpa.enableNetwork(0);
    return wpa.selectNetwork(0);
}).then(function () {
    wpa.close();
}).catch(function (err) {
    console.log(err);
});

wpaCtrl.connect() ⇒ Promise

connect to wpa control interface

Kind: instance method of WpaCtrl

wpaCtrl.close()

close the wpa control interface

Kind: instance method of WpaCtrl

wpaCtrl.sendCmd(msg) ⇒ Promise

send request to wpa_supplicant control interface

Kind: instance method of WpaCtrl

| Param | Type | Description | | --- | --- | --- | | msg | string | wpa_supplicant commands |

wpaCtrl.scan() ⇒ Promise

scan for wifi AP

Kind: instance method of WpaCtrl

wpaCtrl.scanResults() ⇒ Promise

request for wifi scan results

Kind: instance method of WpaCtrl

wpaCtrl.addNetwork() ⇒ Promise

add new network

Kind: instance method of WpaCtrl

wpaCtrl.listNetworks() ⇒ Promise

request to list networks

Kind: instance method of WpaCtrl

wpaCtrl.status() ⇒ Promise

request for status

Kind: instance method of WpaCtrl

wpaCtrl.setNetworkVariable(networkId, variable, value) ⇒ Promise

set network variable

Kind: instance method of WpaCtrl

| Param | Type | Description | | --- | --- | --- | | networkId | number | network id recieved from list networks | | variable | string | variable to set | | value | string | value for the variable |

wpaCtrl.setNetworkSSID(networkId, ssid) ⇒ Promise

set network ssid

Kind: instance method of WpaCtrl

| Param | Type | Description | | --- | --- | --- | | networkId | number | network id recieved from list networks | | ssid | string | ssid of the network |

wpaCtrl.setNetworkPreSharedKey(networkId, preSharedKey, ssid) ⇒ Promise

set network pre-shared key

Kind: instance method of WpaCtrl

| Param | Type | Description | | --- | --- | --- | | networkId | number | networkId network id recieved from list networks | | preSharedKey | string | pre-shared key | | ssid | string | ssid of the network |

wpaCtrl.setNetworkIdentity(networkId, identity) ⇒ Promise

set network identity

Kind: instance method of WpaCtrl

| Param | Type | Description | | --- | --- | --- | | networkId | number | network id recieved from list networks | | identity | string | identity string for EAP |

wpaCtrl.setNetworkPassword(networkId, password) ⇒ Promise

set network password

Kind: instance method of WpaCtrl

| Param | Type | Description | | --- | --- | --- | | networkId | number | network id recieved from list networks | | password | string | password string for EAP |

wpaCtrl.enableNetwork(networkId) ⇒ Promise

enable configured network

Kind: instance method of WpaCtrl

| Param | Type | Description | | --- | --- | --- | | networkId | number | networkId network id recieved from list networks |

wpaCtrl.selectNetwork(networkId) ⇒ Promise

select network to connect

Kind: instance method of WpaCtrl

| Param | Type | Description | | --- | --- | --- | | networkId | number | networkId network id recieved from list networks |

wpaCtrl.saveConfig() ⇒ Promise

save the current configuration

Kind: instance method of WpaCtrl

wpaCtrl.reconfigure() ⇒ Promise

reload the configuration from disk

Kind: instance method of WpaCtrl

wpaCtrl.reassociate() ⇒ Promise

Force reassociation

Kind: instance method of WpaCtrl

wpaCtrl.disconnectAP() ⇒ Promise

disconnect from AP

Kind: instance method of WpaCtrl

wpaCtrl.peerFind() ⇒ Promise

search for peers

Kind: instance method of WpaCtrl

wpaCtrl.peerStopFind() ⇒ Promise

stop peer search

Kind: instance method of WpaCtrl

wpaCtrl.peerInfo(peerAddress) ⇒ Promise

fetch Peer Information

Kind: instance method of WpaCtrl

| Param | Type | Description | | --- | --- | --- | | peerAddress | string | peer device address |

wpaCtrl.peerConnectPBC(peerAddress, isOwner) ⇒ Promise

connect to peer with PBC(Push Button Control) authentication mechanism

Kind: instance method of WpaCtrl

| Param | Type | Description | | --- | --- | --- | | peerAddress | string | Mac Address of peer | | isOwner | Boolean | Your role, are you group owner? if yes then true else false |

wpaCtrl.peerConnectPIN(peerAddress, pin, isOwner) ⇒ Promise

connect to peer with PIN(password) authentication mechanism

Kind: instance method of WpaCtrl

| Param | Type | Description | | --- | --- | --- | | peerAddress | string | Mac Address of peer | | pin | string | password for authentication | | isOwner | Boolean | Your role, are you group owner? if yes then true else false |

wpaCtrl.listInterfaces() ⇒ Promise

list network interfaces on system

Kind: instance method of WpaCtrl

wpaCtrl.removeVitualInterface(iFaceName, callback) ⇒ Promise

Remove virtual interface eg: p2p-p2p0-1

Kind: instance method of WpaCtrl

| Param | Type | Description | | --- | --- | --- | | iFaceName | string | interface name | | callback | function | callback function |

wpaCtrl.flushPeers() ⇒ Promise

Flush peer data

Kind: instance method of WpaCtrl