Socket
Socket
Sign inDemoInstall

is-invalid-path

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

is-invalid-path

Returns true if a file path has invalid characters.


Version published
Weekly downloads
1.9M
increased by1.5%
Maintainers
1
Weekly downloads
 
Created

What is is-invalid-path?

The is-invalid-path npm package is a utility that helps determine if a given file path is invalid. It is useful for validating file paths in various environments and ensuring that paths conform to the expected format.

What are is-invalid-path's main functionalities?

Basic Path Validation

This feature allows you to check if a given path is invalid. The function returns true if the path is invalid and false if it is valid.

const isInvalidPath = require('is-invalid-path');

const path1 = 'C:\invalid|path';
const path2 = '/valid/path';

console.log(isInvalidPath(path1)); // true
console.log(isInvalidPath(path2)); // false

Custom Invalid Characters

This feature allows you to specify custom invalid characters for path validation. The function will check the path against these custom characters and return true if the path contains any of them.

const isInvalidPath = require('is-invalid-path');

const customInvalidChars = ['*', '?', '<', '>', '|'];
const path1 = 'C:\invalid*path';
const path2 = '/valid/path';

console.log(isInvalidPath(path1, customInvalidChars)); // true
console.log(isInvalidPath(path2, customInvalidChars)); // false

Other packages similar to is-invalid-path

Keywords

FAQs

Package last updated on 06 May 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc