mirror of
https://github.com/calmh/node-hostsfile.git
synced 2026-07-17 01:35:04 +00:00
[UNMAINTAINED] Manipulate the /etc/hosts file
- JavaScript 100%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| lib | ||
| test | ||
| LICENSE | ||
| package.json | ||
| README.md | ||
| testReplace.js | ||
This project is not actively maintained
Issues and pull requests on this repository may not be acted on in a timely manner, or at all. You are of course welcome to use it anyway. You are even more welcome to fork it and maintain the results.
node-hostsfile
Manipulate the /etc/hosts file.
var hf = require('./lib/hostsfile');
hf.readHostsFile(function (err, data) {
if (err)
throw err;
var hosts = [
{ip: '10.1.2.3', names: ['test1', 'test1-alias']},
];
data = hf.addHosts(data, hosts, 'test');
hf.replaceHostsFile(data, function (err) {
if (err)
throw err;
console.log('Done');
});
});
License
MIT
