npm install file-data
const FileData = require('file-data');
//f has info about the file
let f = new FileData('./files/index.html');
FileData {
basename,
dir,
ext,
filename,
mimetype,
name,
stats,
type,
format()
}
Use new FileData('filename')
to get an object with a bunch of info about a file.