This package, `is-local-path`, provides a utility function to determine if a given string represents a local file system path rather than a remote URL (like HTTP/HTTPS) or a data URI. It achieves this by checking for common remote path prefixes and data URI schemes. The current stable version is `0.1.6`, which was last updated approximately seven years ago (around 2017), indicating that the project is no longer actively maintained. Due to its age and lack of updates, it primarily supports CommonJS environments, and its path detection logic may not fully account for all modern path conventions, browser-specific path structures, or exotic URL schemes introduced since its last release. It serves as a straightforward, lightweight checker for basic local path identification, distinguishing common local paths (e.g., `/a/b`, `./c`, `../d`) from network or data paths.
npm install is-local-pathVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to import and use the `isLocalPath` function to test various path strings, differentiating between local file system paths and non-local URI schemes.
Consider using more actively maintained alternatives or implementing custom path validation logic if strict security or up-to-date path parsing is required.
For ESM projects, use `import isLocalPath from 'is-local-path';` and ensure your bundler or Node.js environment is configured to handle CommonJS module interoperability. The `require()` syntax remains the most reliable for Node.js CJS projects.
Thoroughly test with your specific path types. For complex scenarios, consider using `new URL()` to robustly parse and validate paths or implementing more comprehensive regex patterns.
Change your import statement to `import isLocalPath from 'is-local-path';` if using ESM, or `const isLocalPath = require('is-local-path');` for CommonJS.If working in an ESM environment, use `import isLocalPath from 'is-local-path';`. If you intend to use CommonJS, ensure your file is `.js` and `type` is not `module` in `package.json`.
No dependency data recorded yet.