- npm: https://www.npmjs.com/package/file-type
安装
npm i file-type
示例
const FileType = require('file-type');
(async () => {
console.log(await FileType.fromFile('baidu.jp'));
//=> {ext: 'png', mime: 'image/png'}
})();
参考
【实战】JavaScript 如何检测文件的类型?
Node.js:file-type检测文件类型
阅读 60
2022-02-12
安装
npm i file-type
示例
const FileType = require('file-type');
(async () => {
console.log(await FileType.fromFile('baidu.jp'));
//=> {ext: 'png', mime: 'image/png'}
})();
参考
【实战】JavaScript 如何检测文件的类型?
相关推荐
精彩评论(0)