wishthis/node_modules/universal-user-agent/dist-src/node.js
2022-01-21 09:28:41 +01:00

12 lines
334 B
JavaScript

import osName from "os-name";
export function getUserAgent() {
try {
return `Node.js/${process.version.substr(1)} (${osName()}; ${process.arch})`;
}
catch (error) {
if (/wmic os get Caption/.test(error.message)) {
return "Windows <version undetectable>";
}
throw error;
}
}