🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more

filename-reserved-regex

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
f

filename-reserved-regex

Regular expression for matching reserved filename characters

3.0.0
latest
100

Supply Chain Security

100

Vulnerability

67

Quality

76

Maintenance

100

License

Trivial Package

Supply chain risk

Packages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.

Found 1 instance in 1 package

Version published
Weekly downloads
5.5M
4.31%
Maintainers
1
Weekly downloads
 
Created
Issues
1

What is filename-reserved-regex?

The filename-reserved-regex npm package provides a regular expression that matches characters that are reserved in filenames across different operating systems. This can be particularly useful for validating filenames or sanitizing them to ensure they are compatible across Windows, macOS, and Unix/Linux systems.

What are filename-reserved-regex's main functionalities?

Validation of filenames

This code sample demonstrates how to use the package to check if a string (which is intended to be used as a filename) contains any reserved characters. The `match` method will return an array of matches if any reserved characters are found, or `null` if the filename is safe to use.

"some*filename?.txt".match(filenameReservedRegex())

Sanitization of filenames

This code sample shows how to sanitize a filename by removing any reserved characters. This is done by replacing any characters that match the regex provided by the package with an empty string, effectively removing them.

"some*filename?.txt".replace(filenameReservedRegex(), '')

Other packages similar to filename-reserved-regex

FAQs

Package last updated on 16 Aug 2021

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