8 Commits

Author SHA1 Message Date
de5cde2ca9 New version added v0.0.5 2016-04-07 14:39:08 +02:00
7cf077d527 Windows Bugfix 2016-04-07 14:38:42 +02:00
253b375923 Another tags added 2016-04-07 13:25:28 +02:00
f22300b438 Build status added 2016-04-07 13:19:42 +02:00
a15dd29c53 travis added, package.json fixes 2016-04-07 13:14:27 +02:00
d01b3cc124 New version added v0.0.4 2016-04-07 06:20:37 +02:00
31d80834a7 npm and node version where to strict 2016-04-07 06:20:18 +02:00
1aff4ba049 Installation info added 2016-04-06 22:02:32 +02:00
5 changed files with 38 additions and 8 deletions

8
.travis.yml Normal file
View File

@ -0,0 +1,8 @@
language: node_js
branches:
only:
- master
- develop
node_js:
- "4"
- "5"

View File

@ -1,5 +1,9 @@
#node-wifi-scanner #node-wifi-scanner
[![Build Status](https://travis-ci.org/ancasicolica/node-wifi-scanner.svg?branch=master)](https://travis-ci.org/ancasicolica/node-wifi-scanner)
[![npm](https://img.shields.io/npm/v/node-wifi-scanner.svg)]()
[![npm](https://img.shields.io/npm/dt/node-wifi-scanner.svg)](https://www.npmjs.com/package/node-wifi-scanner)
This module for node.js scans available wifi networks. The main purpose was to enhance my node.js based This module for node.js scans available wifi networks. The main purpose was to enhance my node.js based
[ZigBee Site Survey Tool](http://ancasicolica.github.io/ZigBeeSiteSurvey/) with WiFi coexistence charts. This tool [ZigBee Site Survey Tool](http://ancasicolica.github.io/ZigBeeSiteSurvey/) with WiFi coexistence charts. This tool
claims to be compatible with current versions of Mac OS-X, Windows and Linux so I'll fix bugs as fast as possible. claims to be compatible with current versions of Mac OS-X, Windows and Linux so I'll fix bugs as fast as possible.
@ -19,6 +23,10 @@ It was tested with the following operating systems:
* Ubuntu 14.04 * Ubuntu 14.04
* Raspbian "Jessie" * Raspbian "Jessie"
## Installation
npm i node-wifi-scanner
## Usage ## Usage
const scanner = require('node-wifi-scanner'); const scanner = require('node-wifi-scanner');
@ -77,3 +85,4 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.

View File

@ -18,9 +18,13 @@ function parseOutput(str, callback) {
var wifis = []; var wifis = [];
var err = null; var err = null;
try { try {
if (blocks.length < 2) {
// 2nd try, with \r\n
blocks = str.split('\r\n\r\n')
}
if (!blocks || blocks.length === 1) { if (!blocks || blocks.length === 1) {
// No WiFis found // No WiFis found
return []; return callback(null, []);
} }
// Each block has the same structure, while some parts might be available and others // Each block has the same structure, while some parts might be available and others

View File

@ -1,27 +1,35 @@
{ {
"name": "node-wifi-scanner", "name": "node-wifi-scanner",
"version": "0.0.3", "version": "0.0.5",
"description": "node.js module for WiFi network detection", "description": "node.js module for WiFi network detection",
"main": "index.js", "main": "index.js",
"keywords": [ "keywords": [
"WiFi", "WiFi",
"Node.js", "Node.js",
"scanner" "scanner",
"airport",
"netsh",
"iwlist",
"nmcli"
], ],
"author": { "author": {
"name": "Christian Kuster, CH-8342 Wernetshausen", "name": "Christian Kuster, CH-8342 Wernetshausen",
"email": "info@kusti.ch", "email": "info@kusti.ch",
"url": "http://www.kusti.ch/" "url": "http://www.kusti.ch/"
}, },
"homepage": "http://www.ferropoly.ch/", "homepage": "https://github.com/ancasicolica/node-wifi-scanner",
"bugs": {
"url": "https://github.com/ancasicolica/node-wifi-scanner/issues",
"email": "info@ancasicolica.ch"
},
"license": "MIT", "license": "MIT",
"repository": { "repository": {
"type": "git", "type": "git",
"url": "https://github.com/ancasicolica/node-wifi-scanner.git" "url": "https://github.com/ancasicolica/node-wifi-scanner.git"
}, },
"engines": { "engines": {
"node": ">= 4.4.0", "node": ">= 4.0.0",
"npm": ">= 2.14.0" "npm": ">= 2.0.0"
}, },
"scripts": { "scripts": {
"test": "mocha test" "test": "mocha test"
@ -31,6 +39,7 @@
}, },
"devDependencies": { "devDependencies": {
"grunt": "0.4.5", "grunt": "0.4.5",
"grunt-bump": "0.7.0" "grunt-bump": "0.7.0",
"mocha": "2.2.5"
} }
} }

View File

@ -93,7 +93,7 @@ describe('netsh', function () {
netsh.parseOutput(fs.readFileSync(path.join(__dirname, 'fixtures', 'netsh', 'netsh_sp.txt'), {encoding: 'utf8'}), (err, info) => { netsh.parseOutput(fs.readFileSync(path.join(__dirname, 'fixtures', 'netsh', 'netsh_sp.txt'), {encoding: 'utf8'}), (err, info) => {
assert.ok(info); assert.ok(info);
assert.equal(info.length, 8); assert.equal(info.length, 8);
console.log(info);
var ap = info[0]; var ap = info[0];
assert.equal(ap.mac, '98:fc:11:b6:88:9e'); assert.equal(ap.mac, '98:fc:11:b6:88:9e');
assert.equal(ap.ssid, 'CARAMANZANAS_BAJA'); assert.equal(ap.ssid, 'CARAMANZANAS_BAJA');