DEV Community

Discussion on: Detect extension in a directory using node js

Collapse
 
mkenzo_8 profile image
mkenzo_8

You could use the path module too, see : nodejs.org/api/path.html#path_path...

My version:

import path from 'path'
const getExtension = file => path.extname(file).slice(1)