hosts-parser
hosts file parser
Usage
var fs = ;var Hosts = Hosts;var hosts = fs;console;/**[ { "ip": "127.0.0.1", "hostname": "localhost" }]**/console;// 127.0.0.1
API
Hosts(hosts) and Hosts.prototype.parse(hosts)
var file = fs;var hosts = file;// or (new Hosts()).parse(file);// return a parsed Hosts object
Hosts.prototype.resolve(hostname)
hosts;// return the ip or undefined
Hosts.prototype.reverse(ip)
hosts;// return the hostname or undefined
Hosts.prototype.reverse(ip, callback)
hosts;
Hosts.prototype.toJSON()
hosts;// return a json formatted object
What is the Hosts file
License
the MIT License.