header-helper

1.0.1 • Public • Published

header-helper

npm codecov Build Status

项目中的扩展名不带前面的点(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集合

TODO:

  • 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

Package Sidebar

Install

npm i header-helper

Weekly Downloads

4

Version

1.0.1

License

MIT

Unpacked Size

1.43 MB

Total Files

20

Last publish

Collaborators

  • ruanjiayou