os: rename getNetworkInterfaces() to networkInterfaces()
This commit is contained in:
parent
b4afe605f4
commit
37bb37d151
@ -109,7 +109,7 @@ Example inspection of os.cpus:
|
|||||||
idle: 1072572010,
|
idle: 1072572010,
|
||||||
irq: 30 } } ]
|
irq: 30 } } ]
|
||||||
|
|
||||||
### os.getNetworkInterfaces()
|
### os.networkInterfaces()
|
||||||
|
|
||||||
Get a list of network interfaces:
|
Get a list of network interfaces:
|
||||||
|
|
||||||
|
12
lib/os.js
12
lib/os.js
@ -29,10 +29,20 @@ exports.totalmem = binding.getTotalMem;
|
|||||||
exports.cpus = binding.getCPUs;
|
exports.cpus = binding.getCPUs;
|
||||||
exports.type = binding.getOSType;
|
exports.type = binding.getOSType;
|
||||||
exports.release = binding.getOSRelease;
|
exports.release = binding.getOSRelease;
|
||||||
exports.getNetworkInterfaces = binding.getInterfaceAddresses;
|
exports.networkInterfaces = binding.getInterfaceAddresses;
|
||||||
exports.arch = function() {
|
exports.arch = function() {
|
||||||
return process.arch;
|
return process.arch;
|
||||||
};
|
};
|
||||||
exports.platform = function() {
|
exports.platform = function() {
|
||||||
return process.platform;
|
return process.platform;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var warnNetworkInterfaces = true;
|
||||||
|
exports.getNetworkInterfaces = function() {
|
||||||
|
if (warnNetworkInterfaces) {
|
||||||
|
console.error("os.getNetworkInterfaces() is deprecated - use os.networkInterfaces()");
|
||||||
|
console.trace();
|
||||||
|
warnNetworkInterfaces = false;
|
||||||
|
}
|
||||||
|
return exports.networkInterfaces();
|
||||||
|
};
|
||||||
|
@ -63,7 +63,7 @@ if (process.platform != 'sunos') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
var interfaces = os.getNetworkInterfaces();
|
var interfaces = os.networkInterfaces();
|
||||||
console.error(interfaces);
|
console.error(interfaces);
|
||||||
switch (platform) {
|
switch (platform) {
|
||||||
case 'linux':
|
case 'linux':
|
||||||
|
Loading…
x
Reference in New Issue
Block a user