Sanitize a filename by removing directory paths and invalid charactersSource:
path_sanitize() removes the following:
Unix reserved filenames (
Trailing periods and spaces (invalid on Windows)
Windows reserved filenames (
LPT9) The resulting string is then truncated to 255 bytes in length
A character vector to be sanitized.
A character vector used to replace invalid characters.
https://www.npmjs.com/package/sanitize-filename, upon which this function is based.