{"id":13494530,"url":"https://github.com/BlackGlory/parse-favicon","last_synced_at":"2025-03-28T14:31:20.096Z","repository":{"id":44965042,"uuid":"74185731","full_name":"BlackGlory/parse-favicon","owner":"BlackGlory","description":"🌳 Parse HTML to get icon information","archived":false,"fork":false,"pushed_at":"2024-12-23T11:02:35.000Z","size":1454,"stargazers_count":55,"open_issues_count":2,"forks_count":8,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-22T20:02:58.578Z","etag":null,"topics":["library","nodejs","npm-package","typescript"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/parse-favicon","language":"TypeScript","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/BlackGlory.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":"2016-11-19T03:58:28.000Z","updated_at":"2025-03-21T03:30:58.000Z","dependencies_parsed_at":"2023-12-20T18:29:18.234Z","dependency_job_id":"7a52b4f2-43d7-4cab-bdba-0972765ad42e","html_url":"https://github.com/BlackGlory/parse-favicon","commit_stats":{"total_commits":152,"total_committers":3,"mean_commits":"50.666666666666664","dds":0.05921052631578949,"last_synced_commit":"411731bed43dfbc9c83aec933d93be3e90a3d278"},"previous_names":[],"tags_count":51,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BlackGlory%2Fparse-favicon","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BlackGlory%2Fparse-favicon/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BlackGlory%2Fparse-favicon/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BlackGlory%2Fparse-favicon/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BlackGlory","download_url":"https://codeload.github.com/BlackGlory/parse-favicon/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246045938,"owners_count":20714873,"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":["library","nodejs","npm-package","typescript"],"created_at":"2024-07-31T19:01:25.809Z","updated_at":"2025-03-28T14:31:19.104Z","avatar_url":"https://github.com/BlackGlory.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"# parse-favicon\nParse HTML to get icon information.\n\n## Install\n```sh\nnpm install --save parse-favicon\n# or\nyarn add parse-favicon\n```\n\n## Usage\n```js\nimport { parseFavicon } from 'parse-favicon'\n\nconst pageURL = 'https://github.com'\n\nparseFavicon(pageURL, fetchText, fetchBuffer)\n  .subscribe(icon =\u003e console.log(icon))\n\nfunction fetchText(url: string): Promise\u003cstring\u003e {\n  return fetch(url)\n    .then(res =\u003e res.text())\n}\n\nfunction fetchBuffer(url: string): Promise\u003cArrayBuffer\u003e {\n  return fetch(url)\n    .then(res =\u003e res.arrayBuffer())\n}\n```\n\n## API\n### parseFavicon\n```ts\ntype TextFetcher = (url: string) =\u003e Awaitable\u003cstring\u003e // string | PromiseLike\u003cstring\u003e\ntype BufferFetcher = (url: string) =\u003e Awaitable\u003cArrayBuffer\u003e // ArrayBuffer | PromiseLike\u003cArrayBuffer\u003e\n\ninterface IIcon {\n  url: string\n  reference: string\n  type: null | string\n  size: null | 'any' | ISize | ISize[]\n}\n\ninterface ISize {\n  width: number\n  height: number\n}\n\nfunction parseFavicon(\n  pageURL: string\n, textFetcher: TextFetcher\n, bufferFetcher?: BufferFetcher\n): Observable\u003cIIcon\u003e\n```\n\n`parseFavicon` accepts `textFetcher` and `bufferFetcher` for further fetching requests when parsing icons, `bufferFetcher` is optional.\nIf you need actual icon sizes and type, should provide `bufferFetcher`.\n\nReferences related to `textFetcher`:\n- `\u003cmeta name=\"msapplication-config\" content=\"path/to/ieconfig.xml\"\u003e`\n- `\u003clink rel=\"manifest\" href=\"path/to/manifest.webmanifest\"\u003e`\n\nReferences related to `bufferFetcher`:\n- `/favicon.ico`\n- `/apple-touch-icon-57x57-precomposed.png`\n- `/apple-touch-icon-57x57.png`\n- `/apple-touch-icon-72x72-precomposed.png`\n- `/apple-touch-icon-72x72.png`\n- `/apple-touch-icon-114x114-precomposed.png`\n- `/apple-touch-icon-114x114.png`\n- `/apple-touch-icon-120x120-precomposed.png`\n- `/apple-touch-icon-120x120.png`\n- `/apple-touch-icon-144x144-precomposed.png`\n- `/apple-touch-icon-144x144.png`\n- `/apple-touch-icon-152x152-precomposed.png`\n- `/apple-touch-icon-152x152.png`\n- `/apple-touch-icon-180x180-precomposed.png`\n- `/apple-touch-icon-180x180.png`\n- `/apple-touch-icon-precomposed.png`\n- `/apple-touch-icon.png`\n\n## Supported references\n- `\u003clink rel=\"icon\" href=\"path/to/icon.png\"\u003e`\n- `\u003clink rel=\"shortcut icon\" href=\"path/to/icon.ico\"\u003e`\n- `\u003clink rel=\"apple-touch-icon\" href=\"path/to/icon.png\"\u003e`\n- `\u003clink rel=\"apple-touch-icon-precomposed\" href=\"path/to/icon.png\"\u003e`\n- `\u003clink rel=\"manifest\" href=\"path/to/manifest.webmanifest\"\u003e`\n- `\u003clink rel=\"fluid-icon\" href=\"path/to/icon.png\"\u003e`\n- `\u003clink rel=\"mask-icon\" href=\"path/to/icon.svg\"\u003e`\n- `\u003cmeta name=\"msapplication-TileImage\" content=\"path/to/icon.png\"\u003e`\n- `\u003cmeta name=\"msapplication-config\" content=\"path/to/ieconfig.xml\"\u003e`\n- `\u003cmeta name=\"msapplication-square70x70logo\" content=\"path/to/icon.png\"\u003e`\n- `\u003cmeta name=\"msapplication-square150x150logo\" content=\"path/to/icon.png\"\u003e`\n- `\u003cmeta name=\"msapplication-square310x310logo\" content=\"path/to/icon.png\"\u003e`\n- `\u003cmeta name=\"msapplication-wide310x150logo\" content=\"path/to/icon.png\"\u003e`\n- `/favicon.ico`\n- `/apple-touch-icon-57x57-precomposed.png`\n- `/apple-touch-icon-57x57.png`\n- `/apple-touch-icon-72x72-precomposed.png`\n- `/apple-touch-icon-72x72.png`\n- `/apple-touch-icon-114x114-precomposed.png`\n- `/apple-touch-icon-114x114.png`\n- `/apple-touch-icon-120x120-precomposed.png`\n- `/apple-touch-icon-120x120.png`\n- `/apple-touch-icon-144x144-precomposed.png`\n- `/apple-touch-icon-144x144.png`\n- `/apple-touch-icon-152x152-precomposed.png`\n- `/apple-touch-icon-152x152.png`\n- `/apple-touch-icon-180x180-precomposed.png`\n- `/apple-touch-icon-180x180.png`\n- `/apple-touch-icon-precomposed.png`\n- `/apple-touch-icon.png`\n\n## Related projects\n- [favicon-detector](https://github.com/BlackGlory/favicon-detector)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FBlackGlory%2Fparse-favicon","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FBlackGlory%2Fparse-favicon","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FBlackGlory%2Fparse-favicon/lists"}