The `x-path` package extends Node.js's native `path` module, providing additional utilities for path manipulation and basic file system checks. It offers methods such as `isAbsolutePath`, `isRelativePath`, `isRootDirectory`, `unifyPathSeparate`, `normalizePathSeparate`, and functions to check if a path refers to a directory or file (`isDirectory`, `isFile`, `isDirectorySync`, `isFileSync`). It also includes functions for retrieving common system directories like `tempdir`, `homedir`, and `datadir`, which are sourced from the `path-extra` package. The current and only release is version 0.0.2, published in 2015. Given its age and complete lack of updates, the package is considered abandoned, with no active development or release cadence. Its initial purpose was to fill gaps in Node.js's built-in `path` module, many of which have since been addressed by the core Node.js `path`, `os`, and `fs` modules, or by widely adopted and maintained third-party alternatives.
npm install x-pathVerified import paths — ran on the pinned version, not inferred.
Demonstrates basic path checks (`isAbsolutePath`, `isRelativePath`), synchronous file system queries (`isDirectorySync`, `isFileSync`), and retrieval of system directories (`tempdir`, `homedir`).
Migrate to native Node.js `path`, `os`, and `fs` modules (e.g., `path.isAbsolute`, `os.homedir`, `os.tmpdir`, `fs.stat`) or use actively maintained alternatives like `fs-extra` for extended file system operations.
For CommonJS, use `const path = require('x-path');`. For ESM projects, rewrite functionality using native Node.js modules or modern, ESM-compatible libraries. If absolutely necessary, you might configure a bundler to transpile or wrap CommonJS modules.Replace `path.isAbsolutePath` with `path.isAbsolute` (from `node:path`), `path.homedir` with `os.homedir()` (from `node:os`), `path.tempdir` with `os.tmpdir()` (from `node:os`). For file/directory checks, use `fs.stat` or `fs.promises.stat` for asynchronous, non-blocking operations.
Always prefer asynchronous file system methods. Use `fs.promises.stat(path)` or `fs.stat(path, callback)` and check the `stats` object (`stats.isDirectory()`, `stats.isFile()`) to determine file or directory type without blocking.
This package is CommonJS-only. If in an ESM project, rewrite the functionality using native Node.js modules (`import { isAbsolute } from 'node:path';`) or modern alternatives. If in a browser, use client-side path utilities or a bundler to transpile.The package exports a single object containing all functions. Use `const path = require('x-path');` and then access methods as `path.isAbsolutePath(somePath);`. Ensure `require('x-path')` successfully returns the module object.Ensure `npm install x-path` has been run. If in an ESM project, this package is not designed for direct `import`. Consider migrating to native Node.js `path`, `os`, and `fs` modules, which are ESM-compatible. Otherwise, if interoperability is configured, ensure correct path resolution.