@hoobs/network
v1.0.20
Published
Library for interacting with network interfaces on Debian based systems.
Downloads
210
Readme
Library for interacting with network interfaces on Debian based systems.
Prerequisites
This library is designed for Debian systems, and requires a few packages to be installed.
sudo apt install wpasupplicant network-manager dnsmasq hostapd
Next you need to disable the dnsmasq and hostapd services. These services will be dynamically configured and controled by this library.
sudo systemctl disable dnsmasq
sudo systemctl disable hostapd
Installing
HOOBS recommends Yarn. From your project's root run;
yarn add @hoobs/network
Or using NPM.
npm install @hoobs/network
Usage
First inport this into your code.
const network = require("./network");
Fetch a list of active connections.
const connections = network.current();
if (network.connected) {
console.log(connections);
}
Fetch a list of network devices.
const devices = network.devices();
Fetch a list of available wireless networks.
const networks = network.wireless.scan();
Connect/Disconnect a wireless network.
network.wireless.connect("ssid", "password");
network.wireless.disconnect();
Forget a network.
network.wireless.forget("ssid");
Up/Down a wired connection.
network.ethernet.up("eth0");
network.ethernet.down("eth0");
Legal
HOOBS and the HOOBS logo are registered trademarks of HOOBS Inc. Copyright (C) 2021 HOOBS Inc. All rights reserved.