UNPKG

@foxglove/ros1

Version:

Standalone TypeScript implementation of the ROS 1 (Robot Operating System) protocol with a pluggable transport layer

33 lines 1.08 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.getNetworkInterfaces = exports.getHostname = exports.getEnvVar = exports.getPid = void 0; const os_1 = __importDefault(require("os")); function getPid() { return process.pid; } exports.getPid = getPid; function getEnvVar(envVar) { return process.env[envVar]; } exports.getEnvVar = getEnvVar; function getHostname() { return os_1.default.hostname(); } exports.getHostname = getHostname; function getNetworkInterfaces() { const output = []; const ifaces = os_1.default.networkInterfaces(); for (const [name, iface] of Object.entries(ifaces)) { if (iface != undefined) { for (const info of iface) { output.push({ name, ...info, cidr: info.cidr ?? undefined }); } } } return output; } exports.getNetworkInterfaces = getNetworkInterfaces; //# sourceMappingURL=platform.js.map