$ cnpm install filenamify
Convert a string to a valid safe filename
On Unix-like systems /
is reserved and <>:"/\|?*
on Windows.
$ npm install filenamify
const filenamify = require('filenamify');
filenamify('<foo/bar>');
//=> 'foo!bar'
filenamify('foo:"bar"', {replacement: '????'});
//=> 'foo????bar'
Convert a string to a valid filename.
Convert the filename in a path a valid filename and return the augmented path.
Type: Object
Type: string
Default: '!'
String to use as replacement for reserved filename characters.
Cannot contain: <
>
:
"
/
\
|
?
*
Type: boolean
Default: 100
Truncate the filename to the given length.
Systems generally allow up to 255 characters, but we default to 100 for usability reasons.
MIT © Sindre Sorhus
Copyright 2013 - present © cnpmjs.org