1.0.1 • Published 4 years ago
wpa-editor v1.0.1
wpa-editor
Install
npm install wpa-editor -save
Description
Scan and edit wpa supplicant config file from NodeJS.
How to use
const wpa = require("wpa-editor");
var wifi = new wpa();
//scan and return all ssid visible in array
wifi.scan(function(err, res){
console.log(res);
})
//edit wpa-supplicant config file (/etc/wpa_supplicant/wpa_supplicant.conf)
//param: SSID[string], password[string]
wifi.editWPA("test","test1234", function(err){
console.log(err);
});
Options
var wifi = new wpa({
{
interfaces : "wlan0", //Default wifi interface
configFilePathname : "/etc/wpa_supplicant/wpa_supplicant.conf", //wpa-supplicant config file location
regex : /^\nnetwork=(.|\n|\r){1,}\}$/gm //parse network in file location
}
});