Coder Social home page Coder Social logo

header-helper's Introduction

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

header-helper's People

Contributors

ruanjiayou avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.