valid-filename
Version:
Check if a string is a valid filename
38 lines (22 loc) • 576 B
Markdown
> Check if a string is a [valid filename](https://github.com/sindresorhus/filename-reserved-regex)
```
$ npm install valid-filename
```
```js
import isValidFilename from 'valid-filename';
isValidFilename('foo/bar');
//=> false
isValidFilename('foo-bar');
//=> true
```
Returns a `boolean` of whether `input` is a valid filename.
Type: `string`
The string to check.
- [filenamify](https://github.com/sindresorhus/filenamify) - Convert a string to a valid safe filename