UNPKG

smart-filename

Version:

NPM package designed for handling filenames safely and effectively. It provides utilities to format, sanitize, validate, truncate, and extract file extensions while ensuring compatibility across different operating systems. This package is particularly us

9 lines (6 loc) 223 B
function getSafeExtension(filename) { if (typeof filename !== 'string') return ''; const match = filename.match(/\.([a-zA-Z0-9]+)$/); return match ? match[1] : ''; } module.exports = getSafeExtension;