Giter Site home page Giter Site logo

mime's Introduction

Mime

Shared MIME-info database specification implementation in D programming language. Shared MIME-info database helps to determine media type of file by its name or contents.

Build Status Coverage Status

Online documentation

Features

Implemented features

  • Reading and using mime.cache files to match file names against glob patterns, match file contents against magic rules, resolve aliases and find mime type parents.
  • Reading various shared MIME-info database files in mime/ subfolder, e.g. globs2, magic and others.
  • treemagic support.
  • Reading MIME types from mime/packages sources and mime/MEDIA folders.
  • Determining MIME type by XMLnamespace if document is xml.

Examples

Run to detect mime types of files.

dub examples/database.d detect README.md source .gitignore lib/libmime.a /bin/sh /var/run/acpid.socket dub.json /dev/sda

Automated mime path detection works only on Freedesktop platforms. On other systmes or for testing purposes it's possible to use mimepath option to set alternate path to mime/ subfolder. E.g. on Windows with KDE installed it would be:

dub examples/database.d --mimepath=C:\ProgramData\KDE\share\mime detect README.md source .gitignore lib/mime.lib C:/Windows/System32/notepad.exe dub.json

Run to print info about MIME types:

dub examples/database.d info application/pdf application/x-executable image/png text/plain text/html text/xml

Run to resolve aliases:

dub examples/database.d resolve application/wwf application/x-pdf application/pgp text/rtf text/xml

Run to test if this library is capable of parsing your local shared MIME-info database:

dub examples/test.d

Run to see names of parsed files:

dub examples/test.d --verbose

As with mimedatabase example you may specify paths to mime folder(s) via command line:

dub examples/test.d --mimepath=C:\ProgramData\KDE\share\mime

mime's People

Contributors

freeslave avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  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.