{"id":13347,"library":"is-local-path","title":"is-local-path","description":"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.","status":"abandoned","version":"0.1.6","language":"javascript","source_language":"en","source_url":"https://github.com/panosoft/is-local-path","tags":["javascript"],"install":[{"cmd":"npm install is-local-path","lang":"bash","label":"npm"},{"cmd":"yarn add is-local-path","lang":"bash","label":"yarn"},{"cmd":"pnpm add is-local-path","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"This package is primarily a CommonJS module, suitable for Node.js environments. The function is exported as the default.","symbol":"isLocalPath","correct":"const isLocalPath = require('is-local-path');"},{"note":"While this module does not officially support ESM, bundlers or Node.js's CJS interoperability (when `type: module` is not set) might allow a default import. Named imports (`{ isLocalPath }`) will likely fail as it's not explicitly exported that way.","wrong":"import { isLocalPath } from 'is-local-path';","symbol":"isLocalPath","correct":"import isLocalPath from 'is-local-path';"}],"quickstart":{"code":"const isLocalPath = require('is-local-path');\n\nconsole.log(isLocalPath('/path/to/file.ext'));     // true\nconsole.log(isLocalPath('/path/to/directory'));    // true\nconsole.log(isLocalPath('./relative/path'));       // true\nconsole.log(isLocalPath('../relative/path'));      // true\nconsole.log(isLocalPath('http://host.com/path/to/file.ext')); // false\nconsole.log(isLocalPath('data:text/plain;base64,SGVsbG8sIFdvcmxkIQ%3D%3D')); // false","lang":"javascript","description":"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."},"warnings":[{"fix":"Consider using more actively maintained alternatives or implementing custom path validation logic if strict security or up-to-date path parsing is required.","message":"The `is-local-path` package is effectively abandoned, with its last update occurring approximately seven years ago (version 0.1.6). This means it receives no further maintenance, bug fixes, or security updates. Users should be aware of potential vulnerabilities or unhandled edge cases with modern path formats.","severity":"gotcha","affected_versions":"<=0.1.6"},{"fix":"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.","message":"This package was developed for CommonJS environments and does not officially support ES Modules (ESM). Direct named imports (`import { isLocalPath } from 'is-local-path'`) will likely result in an undefined export or runtime error without transpilation or specific Node.js CJS-ESM interop settings.","severity":"gotcha","affected_versions":"<=0.1.6"},{"fix":"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.","message":"The path detection logic in `is-local-path` is simple and might not cover all modern or nuanced path definitions, especially those used in browser environments (e.g., `blob:` URLs, service worker caches, or certain `file://` URL interpretations by browsers) or specific OS-level path quirks. It primarily checks for common remote prefixes.","severity":"gotcha","affected_versions":"<=0.1.6"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"fix":"Change your import statement to `import isLocalPath from 'is-local-path';` if using ESM, or `const isLocalPath = require('is-local-path');` for CommonJS.","cause":"Attempting to use `import { isLocalPath } from 'is-local-path';` in an ES Module context where the package only provides a default export.","error":"TypeError: isLocalPath is not a function"},{"fix":"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`.","cause":"Attempting to use `require('is-local-path')` in an ES Module file (`.mjs` or `type: module` in `package.json`) without appropriate transpilation or Node.js loader configuration.","error":"ReferenceError: require is not defined"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null}