{"id":32187319,"url":"https://github.com/invetica/media-types","last_synced_at":"2026-02-21T13:01:33.887Z","repository":{"id":62432982,"uuid":"92760557","full_name":"invetica/media-types","owner":"invetica","description":"Media types (https://tools.ietf.org/html/rfc2046).","archived":false,"fork":false,"pushed_at":"2017-05-29T17:23:41.000Z","size":56,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-01-01T19:22:51.986Z","etag":null,"topics":["api","clojure","http","media-types","mime"],"latest_commit_sha":null,"homepage":null,"language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/invetica.png","metadata":{"files":{"readme":"README.org","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-05-29T17:20:07.000Z","updated_at":"2023-08-07T08:16:16.000Z","dependencies_parsed_at":"2022-11-01T21:15:55.457Z","dependency_job_id":null,"html_url":"https://github.com/invetica/media-types","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/invetica/media-types","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/invetica%2Fmedia-types","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/invetica%2Fmedia-types/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/invetica%2Fmedia-types/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/invetica%2Fmedia-types/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/invetica","download_url":"https://codeload.github.com/invetica/media-types/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/invetica%2Fmedia-types/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29681468,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-21T12:30:22.644Z","status":"ssl_error","status_checked_at":"2026-02-21T12:29:55.402Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","clojure","http","media-types","mime"],"created_at":"2025-10-22T00:02:17.798Z","updated_at":"2026-02-21T13:01:33.870Z","avatar_url":"https://github.com/invetica.png","language":"Clojure","funding_links":[],"categories":[],"sub_categories":[],"readme":"*Media Types* knows how to parse, and generate media type strings that you might\nuse in HTTP content negotiation.\n\n#+BEGIN_HTML\n\u003ca href=\"https://circleci.com/gh/invetica/media-types\"\u003e\n  \u003cimg src=\"https://circleci.com/gh/invetica/media-types.svg\"\u003e\u003c/img\u003e\n\u003c/a\u003e\n\n\u003ca href=\"https://clojars.org/invetica/media-types\"\u003e\n  \u003cimg src=\"https://img.shields.io/clojars/v/invetica/media-types.svg\"\u003e\u003c/img\u003e\n\u003c/a\u003e\n#+END_HTML\n\n* Contents                                                              :TOC:\n - [[#why-this-library][Why this library?]]\n - [[#usage][Usage]]\n - [[#tests][Tests]]\n - [[#further-reading][Further Reading]]\n - [[#license][License]]\n\n* Why this library?\nOther solutions exist but are either a bit too featureful. This library aims to\nbe small, lightweight, easy to use, and fast.\n\nFor a more complete solution that includes detection of file types, can suggest\nextensions etc. you might want to check out [[https://tika.apache.org/][Apache Tika]].\n\n* Usage\nYou can parse a string media type into a map of ~:toptype~, ~:subtype~, and\n~:params~, where the media type string is of the form:\n\n#+begin_example\n\u003ctoptype\u003e/\u003csubtype\u003e[; params]+\n#+end_example\n\nGiven a media type of \"application/json; charset=utf-8\", we can parse this into\na map like so:\n\n#+begin_src clojure\n  (require '[invetica.media-types :as media])\n  (media/parse \"application/json; charset=utf-8\")\n  ;; =\u003e {:params {\"charset\" \"utf-8\"}\n  ;;     :subtype \"javascript\"\n  ;;     :toptype \"application\"}\n#+end_src\n\n* Tests\nThe test suite makes sure we can parse every registered media type, which\nrequires a bit of XML pulled from IANA. This data is vendored into the\nrepository to save IANA's bandwidth, and to ensure we don't need the internet to\nrun our tests.\n\nYou can pull the latest list of registered media types using curl like so:\n\n#+begin_src bash\n  mkdir -p dev-resources/invetica\n  curl -o dev-resources/invetica/media-types.xml \\\n    https://www.iana.org/assignments/media-types/media-types.xml\n#+end_src\n\n#+RESULTS:\n\n* Further Reading\n- https://tools.ietf.org/html/rfc2046\n- https://www.iana.org/assignments/media-types/media-types.xhtml\n- https://en.wikipedia.org/wiki/Media_type\n\n* License\nThe MIT License (MIT)\n\nCopyright © 2017 Invetica Ltd\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the \"Software\"), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\nthe Software, and to permit persons to whom the Software is furnished to do so,\nsubject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\nFOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\nCOPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\nIN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\nCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finvetica%2Fmedia-types","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finvetica%2Fmedia-types","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finvetica%2Fmedia-types/lists"}