Comments (3)
Hi,
Can you format your code using code balise in markdown.
Node-wifi is not meant to be used on server since most of the time servers don't have any wifi card. And you cannot used node-wifi in the broswer since it uses child-process from node api.
from node-wifi.
I see...I guess I need to find another library. Thank you though!
Sorry about the messy code. Here's the formatted one if you're interested. Some CS student helped me with it so I'm not 100% sure about how it works.
var express = require('express');
var app = express();
var wifi = require('node-wifi');
var parsedNetworks;
var cors = require('cors');
var ip = require('ip');
var myIP = ip.address();
var https = require('https');
var path = require('path');
var fs = require('fs');
console.log(myIP);
app.use(cors())
/*wifi*/
wifi.init({
iface :null
});
wifi.scan(function(err, networks){
if(err){
console.log(err);
}else{
// pushing data to array "parsedNetworks"
parsedNetworks = [];
networks.forEach(function(e){
parsedNetworks.push({'ssid': e.ssid, 'signal_level':e.signal_level, 'mac':e.mac, 'security':e.security})
})
// consoling ssid of each signal
for(i=0;i<networks.length;i++){
console.log(networks[i].ssid);
}
}
});
// sending wifi data at url/getwifis
app.get('/getwifis', function (req, res) {
res.json(parsedNetworks);
})
// setting up https server
var certOptions = {
key: fs.readFileSync(path.resolve('server.key')),
cert: fs.readFileSync(path.resolve('server.crt'))
}
var server = https.createServer(certOptions, app).listen(8081,function () {
var host = server.address().address
var port = server.address().port
console.log("Example app listening at https://%s:%s", host, port)
})
from node-wifi.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
from node-wifi.
Related Issues (20)
- Is WPS already integrated or planned to integrate it?
- Windows: not able to connect to network due to non-admin rights on PC
- How can i see ip address when i connect to wi-fi ? HOT 3
- separate cli usage to a own package? HOT 2
- Error: spawn nmcli ENOENT (Linux/Raspberry Pi) HOT 15
- How to fix ssid name like �? HOT 2
- No Error Thrown at Wrong Password HOT 1
- [Bug]: Returning [] empty array on macOS Monterey HOT 21
- Send fake Mac address when connecting to a network HOT 1
- [Bug]: Linux Disconnect Not Working HOT 4
- [Feat]: More information about `.init()` HOT 2
- [Bug]: not support security WPA3 on Windows 10 HOT 1
- [Bug]: Win 10 and 11 differences in `getCurrentConnections`
- [Feat]: Get empty BSSID string in macOS Monterey (> 12.1) HOT 2
- [Feat]: Add language support HOT 1
- [Bug]: In ubuntu22.04, the return value is an empty array when i use getCurrentConnections method
- [Bug]: Wrong data returns for getCurrentConnections on windows 11 HOT 3
- [Bug]: Running in ESM (*.mjs) returns "ERROR : use init before" HOT 1
- Still maintained? HOT 1
- I can't get wifi list when I use wifi.scan().
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from node-wifi.