valid-filename
TypeScript icon, indicating that this package has built-in type declarations

4.0.0 • Public • Published

valid-filename

Check if a string is a valid filename

Install

$ npm install valid-filename

Usage

import isValidFilename from 'valid-filename';

isValidFilename('foo/bar');
//=> false

isValidFilename('foo-bar');
//=> true

API

isValidFilename(input)

Returns a boolean of whether input is a valid filename.

input

Type: string

The string to check.

Related

  • filenamify - Convert a string to a valid safe filename

Package Sidebar

Install

npm i valid-filename

Weekly Downloads

49,631

Version

4.0.0

License

MIT

Unpacked Size

3.29 kB

Total Files

5

Last publish

Collaborators

  • sindresorhus