Jason Gerfen wrote a package for using nmap with node.js if you’re interested.
From jsclasses.org:
“This is a Node.js module that can scan a network for computers using nmap.
It uses the nmap program to either discover local computers in the same network address range or scan a network of remote computers within a given range.
It outputs a listing of details computers found including IP addresses as well opened ports that were found.”
http://www.jsclasses.org/package/315-JavaScript-Scan-a-network-for-computers-using-nmap.html