Skip to content

Commit

Permalink
3.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
victrme committed Feb 1, 2025
1 parent 4895af4 commit 1193b0e
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 13 deletions.
17 changes: 9 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,31 @@

Favicon fetcher finds sites favicons and fetches them fast

- Test it here: https://favicon.victr.me
- On JSR: https://jsr.io/@victr/favicon-fetcher
- On NPM: https://www.npmjs.com/package/@victr/favicon-fetcher
- Test it here: https://favicon.victr.me
- On JSR: https://jsr.io/@victr/favicon-fetcher
- On NPM: https://www.npmjs.com/package/@victr/favicon-fetcher

## Use

```ts
import favicon from "@victr/favicon-fetcher"
import favicon from '@victr/favicon-fetcher'

window.onload = async function () {
const img = document.getElementById("some-id")
const url = await favicon.text("https://github.com")
const img = document.getElementById('some-id')
const url = await favicon.text('https://github.com')
img.src = url
}
```

### Types

```ts
export default {
interface Default {
text: (query: string, fast?: true) => Promise<string>
blob: (query: string, fast?: true) => Promise<Blob>
list: (query: string) => Promise<string[]>
fetch: (request: Request) => Promise<Response>
list: (query: string) => Promise<string[]>
debug: (query: string) => Promise<Debug>
}
```

Expand Down
2 changes: 1 addition & 1 deletion deno.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@victr/favicon-fetcher",
"version": "3.0.4",
"version": "3.1.0",
"license": "MIT",
"exports": "./package/src/index.ts",
"imports": {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@victr/favicon-fetcher",
"version": "3.0.4",
"version": "3.1.0",
"author": "Victor Azevedo",
"description": "Favicon fetcher finds favicons and flawlessly fetches them fast",
"license": "MIT",
Expand Down
6 changes: 3 additions & 3 deletions package/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export default {
text: faviconAsText,
blob: faviconAsBlob,
fetch: faviconAsFetch,
debug: debugFaviconFetch,
debug: debugFavicon,
list: listAvailableFavicons,
}

Expand Down Expand Up @@ -84,7 +84,7 @@ export async function listAvailableFavicons(query: string): Promise<string[]> {
* @param query - Must add protocol in order to work (http:// or https://)
* @returns A collection of data parsed by favicon fetcher
*/
export async function debugFaviconFetch(query: string): Promise<Debug> {
export async function debugFavicon(query: string): Promise<Debug> {
debugList = {}
await main(query, "text", { debug: true, fast: true })
return debugList
Expand Down Expand Up @@ -139,7 +139,7 @@ export async function faviconAsFetch(request: Request): Promise<Response> {
}

case "debug": {
const debug = await debugFaviconFetch(query)
const debug = await debugFavicon(query)
headers.set("Content-Type", "application/json")
return new Response(JSON.stringify(debug), { headers })
}
Expand Down

0 comments on commit 1193b0e

Please sign in to comment.