{"library":"path-browserify","title":"Node.js Path Module for Browsers","description":"`path-browserify` provides a browser-compatible implementation of the Node.js `path` module, designed primarily for environments where the native Node.js module is unavailable, such as web browsers. It is commonly used as a transparent polyfill by JavaScript bundlers like Browserify and Webpack, often eliminating the need for direct installation in many projects. The current stable version, v1.0.1, mirrors the Node.js 10.3.0 `path` API, ensuring consistent behavior for POSIX-style path operations. Unlike the full Node.js module, `path-browserify` only implements POSIX functions and does not include Windows-specific (`path.win32`) utilities. Releases are typically driven by updates to the Node.js `path` module, with a focus on porting features and bugfixes directly from the Node.js core to maintain strict API parity. This approach makes it a reliable choice for projects needing Node.js `path` functionality in browser contexts without introducing new APIs.","language":"javascript","status":"active","last_verified":"Sun Apr 19","install":{"commands":["npm install path-browserify"],"cli":null},"imports":["const path = require('path-browserify')","const path = require('path')"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"const path = require('path-browserify'); // Or 'path' if using a bundler that aliases it\n\n// Example 1: Joining path segments\nconst directory = '/users/documents';\nconst filename = 'report.pdf';\nconst fullPath = path.join(directory, filename);\nconsole.log('Joined path:', fullPath); // Expected: /users/documents/report.pdf\n\n// Example 2: Extracting path components\nconst filePath = '/home/user/app/index.js';\nconsole.log('Basename:', path.basename(filePath)); // Expected: index.js\nconsole.log('Dirname:', path.dirname(filePath));   // Expected: /home/user/app\nconsole.log('Extname:', path.extname(filePath));   // Expected: .js\n\n// Example 3: Resolving relative paths\nconst from = '/data/files';\nconst to = '../../temp/log.txt';\nconst resolvedPath = path.resolve(from, to);\nconsole.log('Resolved path:', resolvedPath); // Expected: /temp/log.txt (simplified for example)\n\n// Example 4: Normalizing a path\nconst uglyPath = '/foo//bar/./baz/../qux';\nconsole.log('Normalized path:', path.normalize(uglyPath)); // Expected: /foo/bar/qux","lang":"javascript","description":"Demonstrates core path operations like joining, extracting components, resolving, and normalizing paths, mimicking the Node.js `path` module API in a browser environment.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}