{"id":28487944,"url":"https://github.com/cssivision/media-type","last_synced_at":"2025-07-01T00:31:03.976Z","repository":{"id":57485191,"uuid":"98857270","full_name":"cssivision/media-type","owner":"cssivision","description":"media type parser and formatter(RFC 6838)","archived":false,"fork":false,"pushed_at":"2017-08-03T03:47:12.000Z","size":5,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-06-20T02:31:53.516Z","etag":null,"topics":["format","media-type","parse"],"latest_commit_sha":null,"homepage":"","language":"Go","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/cssivision.png","metadata":{"files":{"readme":"README.md","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-07-31T06:47:50.000Z","updated_at":"2017-08-03T10:25:51.000Z","dependencies_parsed_at":"2022-08-26T13:23:30.831Z","dependency_job_id":null,"html_url":"https://github.com/cssivision/media-type","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cssivision%2Fmedia-type","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cssivision%2Fmedia-type/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cssivision%2Fmedia-type/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cssivision%2Fmedia-type/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cssivision","download_url":"https://codeload.github.com/cssivision/media-type/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cssivision%2Fmedia-type/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":258664356,"owners_count":22738022,"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":["format","media-type","parse"],"created_at":"2025-06-08T05:08:27.980Z","updated_at":"2025-07-01T00:31:03.963Z","avatar_url":"https://github.com/cssivision.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# media-type\n[![Build Status](https://img.shields.io/travis/cssivision/media-type.svg?style=flat-square)](https://travis-ci.org/cssivision/media-type)\n[![Coverage Status](http://img.shields.io/coveralls/cssivision/media-type.svg?style=flat-square)](https://coveralls.io/github/cssivision/media-type?branch=master)\n[![License](http://img.shields.io/badge/license-mit-blue.svg?style=flat-square)](https://github.com/cssivision/media-type/blob/master/LICENSE)\n\nRFC 6838 media type parser.\nparse media type into type, subtype, and suffix, or format normal media types string use those parts.\n\n# Installation\n\n```sh\ngo get github.com/cssivision/media-type\n```\n\n# Usage\n## parse media type\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\n\tmediaType \"github.com/cssivision/media-type\"\n)\n\nfunc main() {\n\tmt, err := mediaType.Parse(\"application/json+xml\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tfmt.Println(\"type: \", mt.Type)\n\tfmt.Println(\"subtype: \", mt.SubType)\n\tfmt.Println(\"suffix: \", mt.Suffix)\n}\n```\n## format media type\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\n\tmediaType \"github.com/cssivision/media-type\"\n)\n\nfunc main() {\n\tmt := \u0026mediaType.MediaType{\n\t\tType:    \"application\",\n\t\tSubType: \"json\",\n\t\tSuffix:  \"xml\",\n\t}\n\tstr, err := mt.Format()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Println(\"media type:\", str)\n}\n```\n\n\n# Licenses\n\nAll source code is licensed under the [MIT License](https://github.com/cssivision/media-type/blob/master/LICENSE).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcssivision%2Fmedia-type","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcssivision%2Fmedia-type","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcssivision%2Fmedia-type/lists"}