UNPKG

@realfavicongenerator/check-favicon

Version:
33 lines (32 loc) 1.84 kB
/// <reference types="node" /> import { FaviconReport, Fetcher } from './types'; export declare const filePathToReadableStream: (path: string) => Promise<ReadableStream>; export declare const filePathToString: (path: string) => Promise<string>; export declare const stringToReadableStream: (str: string) => ReadableStream; export declare const readableStreamToString: (readableStream: ReadableStream) => Promise<string>; export declare const readableStreamToBuffer: (readableStream: ReadableStream) => Promise<Buffer>; export type CheckIconProcessor = { noHref: () => void; icon404: () => void; cannotGet: (httpStatusCode: number) => void; downloadable: () => void; square: (widthHeight: number) => void; notSquare: (width: number, Height: number) => void; rightSize: (widthHeight: number) => void; wrongSize: (widthHeight: number) => void; }; export declare const pathToMimeType: (path: string) => string; export type CheckIconOutput = { content: string | null; url: string | null; width: number | null; height: number | null; }; export declare const checkIcon: (iconUrl: string | undefined, processor: CheckIconProcessor, fetcher: Fetcher, mimeType: string | undefined, expectedWidthHeight?: number) => Promise<CheckIconOutput | null>; export declare const mergeUrlAndPath: (baseUrl: string, absoluteOrRelativePath: string) => string; export declare const parseSizesAttribute: (sizes: string | undefined | null) => number | null; export declare const bufferToDataUrl: (buffer: Buffer, mimeType: string) => string; export declare const filePathToDataUrl: (filePath: string) => Promise<string>; export declare const fetchFetcher: Fetcher; export declare const reportHasErrors: (report: FaviconReport) => boolean; export declare const reportHasWarnings: (report: FaviconReport) => boolean;