An open API service indexing awesome lists of open source software.

https://github.com/soundux/pantomime

🗃️ A C++ library for work with mime-types
https://github.com/soundux/pantomime

cpp cpp-library cpp17 cpp17-library mime mime-database mime-type mime-types mimetypes

Last synced: 7 months ago
JSON representation

🗃️ A C++ library for work with mime-types

Awesome Lists containing this project

README

          





### 📋 About

_Pantomime_ is a simple to use, zero-dependency, straight-forward, C++17 library for work with mime-types.

### 📦 Installation

- With FetchContent
```cmake
include(FetchContent)

FetchContent_Declare(pantomime GIT_REPOSITORY "https://github.com/Soundux/pantomime")
FetchContent_MakeAvailable(pantomime)

target_link_libraries( soundux::pantomime)
```
- As Git-Submodule
```bash
$ git submodule add https://github.com/Soundux/pantomime
```
```cmake
add_subdirectory(pantomime)
target_link_libraries( soundux::pantomime)
```

### 🚀 Simple Example

```cpp
auto mime = pantomime::mime::from("test.mp4").value(); // or pantomime::mime::get("video/mp4");

assert(mime.type == "video");
assert(mime.sub_type == "mp4");
assert(mime.extensions.count("mp4"));
assert(mime.compressible.value() == false);
```

---

> _Pantomime_ is based on [mime-db](https://github.com/jshttp/mime-db)
> Our logo was generated by [DALL-E](https://openai.com/dall-e-2/)