# parse-favicon

> Parse HTML to get icon information

Latest version **7.0.3** (published 2026-05-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install parse-favicon
pnpm add parse-favicon
yarn add parse-favicon
bun add parse-favicon
```

## Health

**Score 60/100 (C)** — status: active.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 7.0.3 |
| Published | 2026-05-23 |
| First published | 2016-11-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=18.17.0 |
| Dependencies | 14 |
| Unpacked size | 69.8 KB |
| Known vulnerabilities | 0 (+3 in 2 direct dependencies) |
| Install scripts | no |
| GitHub stars | 57 |
| Author | BlackGlory |
| Maintainers | black_glory |
| Keywords | favicon, icon, shortcut, apple-touch-icon, manifest, fluid-icon, mask-icon, msapplication |

## Links

- npm: https://www.npmjs.com/package/parse-favicon
- Repository: https://github.com/BlackGlory/parse-favicon
- Homepage: https://github.com/BlackGlory/parse-favicon#readme
- Issues: https://github.com/BlackGlory/parse-favicon/issues
- npm.io page: https://npm.io/package/parse-favicon

## Dependencies (14)

- [rxjs](https://npm.io/package/rxjs.md) ^7.8.0
- [urijs](https://npm.io/package/urijs.md) ^1.19.11
- [is-svg](https://npm.io/package/is-svg.md) ^5.0.0
- [extra-dom](https://npm.io/package/extra-dom.md) ^0.6.1
- [file-type](https://npm.io/package/file-type.md) ^18.2.0
- [image-size](https://npm.io/package/image-size.md) ^1.0.2
- [extra-utils](https://npm.io/package/extra-utils.md) ^5.0.1
- [extra-memoize](https://npm.io/package/extra-memoize.md) ^0.9.3
- [extra-promise](https://npm.io/package/extra-promise.md) ^6.0.3
- [@blackglory/query](https://npm.io/package/@blackglory/query.md) ^0.5.6
- [iterable-operator](https://npm.io/package/iterable-operator.md) ^4.0.3
- [@blackglory/errors](https://npm.io/package/@blackglory/errors.md) ^3.0.0
- [@blackglory/prelude](https://npm.io/package/@blackglory/prelude.md) ^0.3.1
- [@extra-memoize/memory-cache](https://npm.io/package/@extra-memoize/memory-cache.md) ^0.2.11

## Alternatives

- [@fortawesome/react-fontawesome](https://npm.io/package/@fortawesome/react-fontawesome.md) — 2.2M weekly downloads
- [roboto-fontface](https://npm.io/package/roboto-fontface.md) — 196.0K weekly downloads
- [@react-native-vector-icons/common](https://npm.io/package/@react-native-vector-icons/common.md) — 150.4K weekly downloads
- [@procore/core-icons](https://npm.io/package/@procore/core-icons.md) — 4.6K weekly downloads
- [@react-md/material-icons](https://npm.io/package/@react-md/material-icons.md) — 1.6K weekly downloads

## Recent versions

- 7.0.3 (latest) — 2026-05-23
- 7.0.2 — 2024-12-23
- 7.0.1 — 2024-03-26
- 7.0.0 — 2023-12-20
- 6.0.2 — 2023-06-11
- 6.0.1 — 2023-02-10
- 6.0.0 — 2023-02-10
- 5.0.4 — 2022-10-18
- 5.0.3 — 2022-03-23
- 5.0.2 — 2022-01-06
- 5.0.1 — 2021-12-17
- 5.0.0 — 2021-12-16
- 4.0.16 — 2021-12-12
- 4.0.15 — 2021-10-14
- 4.0.14 — 2021-09-15
- … 45 more at https://npm.io/package/parse-favicon/versions

## README

# parse-favicon
Parse HTML to get icon information.

## Install
```sh
npm install --save parse-favicon
# or
yarn add parse-favicon
```

## Usage
```js
import { parseFavicon } from 'parse-favicon'

const pageURL = 'https://github.com'

parseFavicon(pageURL, fetchText, fetchBuffer)
  .subscribe(icon => console.log(icon))

function fetchText(url: string): Promise<string> {
  return fetch(url)
    .then(res => res.text())
}

function fetchBuffer(url: string): Promise<ArrayBuffer> {
  return fetch(url)
    .then(res => res.arrayBuffer())
}
```

## API
### parseFavicon
```ts
type TextFetcher = (url: string) => Awaitable<string> // string | PromiseLike<string>
type BufferFetcher = (url: string) => Awaitable<ArrayBuffer> // ArrayBuffer | PromiseLike<ArrayBuffer>

interface IIcon {
  url: string
  reference: string
  type: null | string
  size: null | 'any' | ISize | ISize[]
}

interface ISize {
  width: number
  height: number
}

function parseFavicon(
  pageURL: string
, textFetcher: TextFetcher
, bufferFetcher?: BufferFetcher
): Observable<IIcon>
```

`parseFavicon` accepts `textFetcher` and `bufferFetcher` for further fetching requests when parsing icons, `bufferFetcher` is optional.
If you need actual icon sizes and type, should provide `bufferFetcher`.

References related to `textFetcher`:
- `<meta name="msapplication-config" content="path/to/ieconfig.xml">`
- `<link rel="manifest" href="path/to/manifest.webmanifest">`

References related to `bufferFetcher`:
- `/favicon.ico`
- `/apple-touch-icon-57x57-precomposed.png`
- `/apple-touch-icon-57x57.png`
- `/apple-touch-icon-72x72-precomposed.png`
- `/apple-touch-icon-72x72.png`
- `/apple-touch-icon-114x114-precomposed.png`
- `/apple-touch-icon-114x114.png`
- `/apple-touch-icon-120x120-precomposed.png`
- `/apple-touch-icon-120x120.png`
- `/apple-touch-icon-144x144-precomposed.png`
- `/apple-touch-icon-144x144.png`
- `/apple-touch-icon-152x152-precomposed.png`
- `/apple-touch-icon-152x152.png`
- `/apple-touch-icon-180x180-precomposed.png`
- `/apple-touch-icon-180x180.png`
- `/apple-touch-icon-precomposed.png`
- `/apple-touch-icon.png`

## Supported references
- `<link rel="icon" href="path/to/icon.png">`
- `<link rel="shortcut icon" href="path/to/icon.ico">`
- `<link rel="apple-touch-icon" href="path/to/icon.png">`
- `<link rel="apple-touch-icon-precomposed" href="path/to/icon.png">`
- `<link rel="manifest" href="path/to/manifest.webmanifest">`
- `<link rel="fluid-icon" href="path/to/icon.png">`
- `<link rel="mask-icon" href="path/to/icon.svg">`
- `<meta name="msapplication-TileImage" content="path/to/icon.png">`
- `<meta name="msapplication-config" content="path/to/ieconfig.xml">`
- `<meta name="msapplication-square70x70logo" content="path/to/icon.png">`
- `<meta name="msapplication-square150x150logo" content="path/to/icon.png">`
- `<meta name="msapplication-square310x310logo" content="path/to/icon.png">`
- `<meta name="msapplication-wide310x150logo" content="path/to/icon.png">`
- `/favicon.ico`
- `/apple-touch-icon-57x57-precomposed.png`
- `/apple-touch-icon-57x57.png`
- `/apple-touch-icon-72x72-precomposed.png`
- `/apple-touch-icon-72x72.png`
- `/apple-touch-icon-114x114-precomposed.png`
- `/apple-touch-icon-114x114.png`
- `/apple-touch-icon-120x120-precomposed.png`
- `/apple-touch-icon-120x120.png`
- `/apple-touch-icon-144x144-precomposed.png`
- `/apple-touch-icon-144x144.png`
- `/apple-touch-icon-152x152-precomposed.png`
- `/apple-touch-icon-152x152.png`
- `/apple-touch-icon-180x180-precomposed.png`
- `/apple-touch-icon-180x180.png`
- `/apple-touch-icon-precomposed.png`
- `/apple-touch-icon.png`

## Related projects
- [favicon-detector](https://github.com/BlackGlory/favicon-detector)

---
_Source: https://npm.io/package/parse-favicon · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
