Last change
on this file since eed0bf8 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
850 bytes
|
Rev | Line | |
---|
[6a3a178] | 1 | "use strict";
|
---|
| 2 |
|
---|
| 3 | const os = require("os");
|
---|
| 4 | const platform = os.platform();
|
---|
| 5 |
|
---|
| 6 | if ([
|
---|
| 7 | "android",
|
---|
| 8 | "darwin",
|
---|
| 9 | "freebsd",
|
---|
| 10 | "linux",
|
---|
| 11 | "openbsd",
|
---|
| 12 | "sunos",
|
---|
| 13 | "win32",
|
---|
| 14 | "aix",
|
---|
| 15 | ].indexOf(platform) !== -1) {
|
---|
| 16 | let file;
|
---|
| 17 | if (platform === "aix") {
|
---|
| 18 | // AIX `netstat` output is compatible with Solaris
|
---|
| 19 | file = `${os.type() === "OS400" ? "ibmi" : "sunos"}.js`;
|
---|
| 20 | } else {
|
---|
| 21 | file = `${platform}.js`;
|
---|
| 22 | }
|
---|
| 23 |
|
---|
| 24 | const m = require(`./${file}`);
|
---|
| 25 | module.exports.v4 = () => m.v4();
|
---|
| 26 | module.exports.v6 = () => m.v6();
|
---|
| 27 | module.exports.v4.sync = () => m.v4.sync();
|
---|
| 28 | module.exports.v6.sync = () => m.v6.sync();
|
---|
| 29 | } else {
|
---|
| 30 | const unsupported = () => { throw new Error(`Unsupported Platform: ${platform}`); };
|
---|
| 31 | module.exports.v4 = unsupported;
|
---|
| 32 | module.exports.v6 = unsupported;
|
---|
| 33 | module.exports.v4.sync = unsupported;
|
---|
| 34 | module.exports.v6.sync = unsupported;
|
---|
| 35 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.