{"id":16721120,"url":"https://github.com/khalyomede/mime","last_synced_at":"2026-02-07T01:31:31.144Z","repository":{"id":96870186,"uuid":"369875787","full_name":"khalyomede/mime","owner":"khalyomede","description":"Mime type enum and function in V.","archived":false,"fork":false,"pushed_at":"2021-05-25T19:47:35.000Z","size":6,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-15T00:18:27.482Z","etag":null,"topics":["content-type","enum","function","mime","vlang"],"latest_commit_sha":null,"homepage":"","language":"V","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/khalyomede.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-05-22T18:07:14.000Z","updated_at":"2021-05-25T19:47:38.000Z","dependencies_parsed_at":null,"dependency_job_id":"068e70af-8524-4905-92ee-7e2f30736868","html_url":"https://github.com/khalyomede/mime","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/khalyomede/mime","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/khalyomede%2Fmime","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/khalyomede%2Fmime/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/khalyomede%2Fmime/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/khalyomede%2Fmime/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/khalyomede","download_url":"https://codeload.github.com/khalyomede/mime/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/khalyomede%2Fmime/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265663015,"owners_count":23807465,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["content-type","enum","function","mime","vlang"],"created_at":"2024-10-12T22:28:52.235Z","updated_at":"2026-02-07T01:31:31.138Z","avatar_url":"https://github.com/khalyomede.png","language":"V","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MIME\n\nList of mime and their file extensions.\n\n```v\nmodule main\n\nimport khalyomede.mime { Mime }\n\nfn main() {\n  text_html := Mime.text_html\n\n  println(text_html) // \"text/html\"\n}\n```\n\n## Summary\n\n- [About](#about)\n- [Features](#features)\n- [Installation](#installation)\n- [Examples](#examples)\n\n## About\n\nI create this package to have a type safe list of allowed mime, to be used to return \"Content-Type\" header for my router.\n\nThis library can be used for other use cases as well.\n\n[back to summary](#summary)\n\n## Features\n\n- List of common MIME types\n- Ability to get allowed file extensions from a MIME type\n- Ability to get the MIME text representation\n- Ability to get a MIME Type from a file extension\n- Ability to get a MIME Type from a MIME text representation\n\n[back to summary](#summary)\n\n## Installation\n\n- [Using V installer](#using-v-installer)\n\n### Using V installer\n\nOn your terminal, run this command:\n\n```bash\nv install khalyomede.mime\n```\n\n[back to summary](#summary)\n\n## Examples\n\n- [Get the text representation](#get-the-text-representation)\n- [Get the list of allowed file extensions](#get-the-list-of-allowed-file-extensions)\n- [Create from a MIME text representation](#create-from-a-mime-text-representation)\n- [Create from a file extension](#create-from-a-file-extension)\n\n### Get the text representation\n\nUse `.str()` or pass it on a parameter accepting a `string` which will convert the MIME type to its text representation.\n\n```v\nmodule main\n\nimport khalyomede.mime { Mime }\n\nfn main() {\n  text_html := Mime.text_html\n\n  assert text_html.str() == \"text/html\"\n}\n```\n\n### Get the list of allowed file extensions\n\n```v\nmodule main\n\nimport khalyomede.mime { Mime }\n\nfn main() {\n  text_html := Mime.text_html\n\n  assert text_html.extensions() == [\"html\"]\n}\n```\n\n### Create from a MIME text representation\n\n```v\nmodule main\n\nimport khalyomede.mime { Mime }\n\nfn main() {\n  text_html := Mime.from_text(\"text/html\") or { Mime.text_html }\n}\n```\n\n### Create from a file extension\n\n```v\nmodule main\n\nimport khalyomede.mime { Mime }\n\nfn main() {\n  text_html := Mime.from_file_extension(\"html\") or { Mime.text_html }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkhalyomede%2Fmime","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkhalyomede%2Fmime","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkhalyomede%2Fmime/lists"}