npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@igorskyflyer/valid-path

v3.0.0

Published

🧰 Determines whether a given value can be a valid file/directory name. 🏜

Downloads

14

Readme

📃 Table of Contents

🤖 Features

  • 🧠 Detects if a file or folder name is valid for the system
  • 🖥 Works on Windows and Unix like systems
  • 🎯 Validates both file and directory names
  • 🚫 Blocks names with reserved words or illegal characters
  • 📏 Enforces system specific length limits
  • ⚡ Returns a clear true or false result instantly

🕵🏼 Usage

Install it by executing any of the following, depending on your preferred package manager:

pnpm add @igorskyflyer/valid-path
yarn add @igorskyflyer/valid-path
npm i @igorskyflyer/valid-path

🤹🏼 API

function isValidPath(path: string, isFile = true): boolean

Returns whether the given path can be a valid file/directory name on the host machine.

function isValidPathUnix(path: string, isFile = true): boolean

Returns whether the given path can be a valid file/directory name on Unix and Unix-like OS'.

function isValidPathWin(path: string, isFile = true): boolean

Returns whether the given path can be a valid file/directory name on Windows OS.

🗒️ Examples

import { isValidPathUnix, isValidPathWin, isValidPath } from '@igorskyflyer/valid-path'

console.log(isValidPathUnix('hello&world.js', true)) // prints true
console.log(isValidPathUnix('hello/world.js', true)) // prints false
console.log(isValidPathUnix('hello/world')) // prints false

console.log(isValidPathWin('hello/world.js', true)) // prints false
console.log(isValidPathWin('hello/world', false)) // prints true
console.log(isValidPathWin('CON7')) // prints true
console.log(isValidPathWin('COM7.txt')) // prints false
console.log(isValidPathWin('CONnection')) // prints true
console.log(isValidPathWin('lpt1')) // prints false
console.log(isValidPathWin('hello&world.js', true)) // prints true

// isValidPath() internally uses the appropriate method for supported OS' (Unix-like and Windows)
// so no need for separate testing

📝 Changelog

📑 The changelog is available here, CHANGELOG.md.

🪪 License

Licensed under the MIT license which is available here, MIT license.

💖 Support

🧬 Related

@igorskyflyer/upath

🎍 Provides a universal way of formatting file-paths in Unix-like and Windows operating systems as an alternative to the built-in path.normalize(). 🧬

@igorskyflyer/windev

🍃 Provides ways of checking whether a path is a legacy Windows device. 💾

@igorskyflyer/valid-path

🧰 Provides ways of testing whether a given value can be a valid file/directory name. 🏜

@igorskyflyer/registry-apppaths

🪀 A Node.js module for reading the AppPaths registry key on Windows. Useful for retrieving applications that can be launched from the command prompt. 🗃

@igorskyflyer/jmap

🕶️ Reads a JSON file into a Map. 🌻

👨🏻‍💻 Author

Created by Igor Dimitrijević (@igorskyflyer).