mime-types

Version, currently 0.1.01 version
  • 0.1.0latestApr 16, 2020

github.com/benemohamed/mime-types

mime-types The ultimate content-type utility.

0 stars
0 dependents
License: MIT

Installation

# Add this to your shard.yml
dependencies:
  mime-types:
    github: benemohamed/mime-types
    version: ~> 0.1.0

Then run:

shards install

shard.yml

Crystal
0.34.0
License
MIT
Author
Mohamed Ben rebia
Target
  • shards from src/mime-types.cr

Dependencies

This version declares no dependencies.

README

mime-types

The ultimate content-type utility.

Installation

  1. Add the dependency to your shard.yml:

    dependencies:
      mime-types:
        github: benemohamed/mime-types
  2. Run shards install

Usage

require "mime-types"
mime = Mime::Type.new

mime.lookup(path)

lookup = mime.lookup("file.json") # 'application/json'

mime.contentType(type)

contentType = mime.contentType("markdown") # 'text/markdown; charset=utf-8'

mime.extension(type)

extension = mime.extension("application/octet-stream") # 'bin'

type = mime::types

A map of content-types by extension.

extensions = mime::extensions

A map of extensions by content-type.

Development

crystal spec

Contributing

  1. Fork it (https://github.com/benemohamed/mime-types/fork)
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors

License

GitHub license