Convert string to safe filename for Unix or Windows, But still look similar for reading
- Unix-like System Rereserved:
/
- Windows System Rereserved:
<>:"/\|?*
$ npm install escape-filename
const escapeFile = require('escape-filename')
const fs = require('fs')
const str = 'foo / bar : | * \\.test'
const escaped = escapeFile.escape(str)
// => "foo ∕ bar ꞉ ❘ ﹡ ﹨.test"
fs.writeFile(escaped, 'test filename', err => {
if (!err) {
console.log('write success')
}
})
Escape filename
Unescape filename
Compare two string after unescape filename
ISC