{"id":18030118,"url":"https://github.com/humphd/browser-mime","last_synced_at":"2025-03-27T03:31:16.376Z","repository":{"id":57190480,"uuid":"175735697","full_name":"humphd/browser-mime","owner":"humphd","description":"MIME types for use in browsers","archived":false,"fork":false,"pushed_at":"2024-08-26T16:14:14.000Z","size":183,"stargazers_count":17,"open_issues_count":0,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-23T01:12:12.206Z","etag":null,"topics":["browser","content-type","javascript","mime","mime-types"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/humphd.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-03-15T02:38:55.000Z","updated_at":"2024-08-26T16:14:18.000Z","dependencies_parsed_at":"2024-10-30T09:13:30.823Z","dependency_job_id":"3069440e-6259-4400-a146-1e6434ec59b9","html_url":"https://github.com/humphd/browser-mime","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/humphd%2Fbrowser-mime","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/humphd%2Fbrowser-mime/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/humphd%2Fbrowser-mime/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/humphd%2Fbrowser-mime/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/humphd","download_url":"https://codeload.github.com/humphd/browser-mime/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245778703,"owners_count":20670682,"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":["browser","content-type","javascript","mime","mime-types"],"created_at":"2024-10-30T09:13:19.758Z","updated_at":"2025-03-27T03:31:16.018Z","avatar_url":"https://github.com/humphd.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# browser-mime [![Build Status](https://travis-ci.org/humphd/browser-mime.svg?branch=master)](https://travis-ci.org/humphd/browser-mime)\n\nMIME types that can be parsed/rendered in most browsers.  The list is automatically\ngenerated from [mime-db](https://github.com/jshttp/mime-db).  Manual types and\nextension information is also included in [src/initial-db.json](src/initial-db.json).\n\nTo rebuild the JS library in `dist/`:\n\n```\nnpm build\n```\n\nTo regenerate the database:\n\n```\nnpm run build-db\n```\n\nThis will reproduce [`browser-mime-db.json`](dist/browser-mime-db.json)\nby attempting to load an empty file of every type in [mime-db](https://www.npmjs.com/package/mime-db), and keep track of which ones Chrome was able to download\nand use vs. prompting the user with a Download popup.\n\nThe [mime-types](https://github.com/jshttp/mime-types.git) project is included as a squashed subtree in [mime-types/](mime-types). To update the subtree code use `npm run update-mime-types`.\n\n## API\n\nThe API is identical too, and shares the same code as, [mime-types](https://github.com/jshttp/mime-types.git).  From their README:\n\n```js\nvar mime = require('mime-types')\n```\n\nAll functions return `false` if input is invalid or not found.\n\n### mime.lookup(path)\n\nLookup the content-type associated with a file.\n\n```js\nmime.lookup('json')             // 'application/json'\nmime.lookup('.md')              // 'text/markdown'\nmime.lookup('file.html')        // 'text/html'\nmime.lookup('folder/file.js')   // 'application/javascript'\nmime.lookup('folder/.htaccess') // false\n\nmime.lookup('cats') // false\n```\n\n### mime.contentType(type)\n\nCreate a full content-type header given a content-type or extension.\nWhen given an extension, `mime.lookup` is used to get the matching\ncontent-type, otherwise the given content-type is used. Then if the\ncontent-type does not already have a `charset` parameter, `mime.charset`\nis used to get the default charset and add to the returned content-type.\n\n```js\nmime.contentType('markdown')  // 'text/x-markdown; charset=utf-8'\nmime.contentType('file.json') // 'application/json; charset=utf-8'\nmime.contentType('text/html') // 'text/html; charset=utf-8'\nmime.contentType('text/html; charset=iso-8859-1') // 'text/html; charset=iso-8859-1'\n\n// from a full path\nmime.contentType(path.extname('/path/to/file.json')) // 'application/json; charset=utf-8'\n```\n\n### mime.extension(type)\n\nGet the default extension for a content-type.\n\n```js\nmime.extension('application/octet-stream') // 'bin'\n```\n\n### mime.charset(type)\n\nLookup the implied default charset of a content-type.\n\n```js\nmime.charset('text/markdown') // 'UTF-8'\n```\n\n### var type = mime.types[extension]\n\nA map of content-types by extension.\n\n### [extensions...] = mime.extensions[type]\n\nA map of extensions by content-type.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhumphd%2Fbrowser-mime","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhumphd%2Fbrowser-mime","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhumphd%2Fbrowser-mime/lists"}