项目中的扩展名不带前面的点(test.jpg => 拓展名jpg)
npm i header-helper -S
const headerhelper = require('header-helper');
const info = headerHelper.getInfo('path-to-file');
/**
* info:
* {
* extension: 'jpg',
* mime: 'image/jpeg',
* type: 'image',
* description: 'JPEG images'
* }
*/
- ext2mime()
- mime2ext()
- path2ext()
- path2mime()
- extensions: 所有extension的Set集合
- file-signature完善,extensions拆分为单个
http://www.garykessler.net/library/file_sigs.html https://www.cnblogs.com/WangAoBo/p/6366211.html https://www.file-extensions.org/extensions/common-file-extension-list