{"library":"os-shim","title":"OS Module API Shim","description":"The `os-shim` package provides a compatibility layer for the native Node.js `os` module API, backporting features that became standard in Node.js 0.10.x to much older versions, specifically 0.4.x and 0.8.x. It shims functions like `os.tmpdir()`, `os.endianness()`, `os.platform()`, `os.arch()`, and the `os.EOL` constant, which were either missing or had differing behaviors in those legacy environments. The package is currently at version 0.1.3 (last updated circa 2013) and has an abandoned release cadence, meaning it is no longer actively maintained. Its primary differentiator was enabling consistent `os` module usage across deeply antiquated Node.js runtimes where standard `os` module features were inconsistent or absent.","language":"javascript","status":"abandoned","last_verified":"Sun Apr 19","install":{"commands":["npm install os-shim"],"cli":null},"imports":["const os = require('os-shim')","os.tmpdir()","os.EOL"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"const osShim = require('os-shim');\n\nconsole.log('Using os-shim to access OS module properties:');\nconsole.log('-------------------------------------------');\n\n// Shimmed methods/properties that were missing in old Node.js versions:\nconsole.log('Temporary directory:', osShim.tmpdir());\nconsole.log('Endianness:', osShim.endianness());\nconsole.log('End-of-Line:', JSON.stringify(osShim.EOL));\nconsole.log('Platform:', osShim.platform());\nconsole.log('Architecture:', osShim.arch());\n\n// Original 'os' module for comparison (if available in the current environment)\n// Note: This shim is primarily for environments where some of these might be missing.\ntry {\n    const nativeOs = require('os');\n    console.log('\\n--- Comparison with native os module (if available) ---');\n    console.log('Native Temporary directory:', nativeOs.tmpdir());\n    console.log('Native Endianness:', nativeOs.endianness());\n    console.log('Native End-of-Line:', JSON.stringify(nativeOs.EOL));\n    console.log('Native Platform:', nativeOs.platform());\n    console.log('Native Architecture:', nativeOs.arch());\n} catch (e) {\n    console.log('\\nNative \\'os\\' module might be partially or fully unavailable in this environment or cannot be loaded.');\n}","lang":"javascript","description":"Demonstrates how to use the `os-shim` package to access various operating system properties like temporary directory, endianness, EOL, platform, and architecture, highlighting its role in legacy environments.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}