Convert a string to a valid safe filename
On Unix-like systems
/ is reserved and
<>:"/\|?* on Windows.
$ npm install filenamify
const filenamify = ;;//=> 'foo!bar';//=> 'foo🐴bar'
Convert a string to a valid filename.
Convert the filename in a path a valid filename and return the augmented path.
String to use as replacement for reserved filename characters.
Truncate the filename to the given length.
Systems generally allow up to 255 characters, but we default to 100 for usability reasons.
You can also import
filenamify/browser, which only imports
filenamify and not
filenamify.path, which relies on
path being available or polyfilled. Importing
filenamify this way is therefore useful when it is shipped using
webpack or similar tools, and if
filenamify.path is not needed.
const filenamify = ;;//=> 'foo!bar'