UNPKG

genshin-manager

Version:

<div align="center"> <p> <a href="https://www.npmjs.com/package/genshin-manager"><img src="https://img.shields.io/npm/v/genshin-manager.svg?maxAge=3600" alt="npm version" /></a> <a href="https://www.npmjs.com/package/genshin-manager"><img src="https:

91 lines (90 loc) 2.17 kB
import fs from 'fs'; import { ClientOption } from '../../types'; /** * Class for compiling information about image */ export declare class ImageAssets { /** * Image base URL of mihoyo */ private static readonly IMAGE_BASE_URL_MIHOYO; /** * Image types */ private static readonly imageTypes; /** * Fetch option */ private static fetchOption; /** * Image base URL by regex */ private static imageBaseURLByRegex; /** * Default image base URL */ private static defaultImageBaseURL; /** * Whether to cache the image */ private static autoCacheImage; /** * Image folder path */ private static imageFolderPath; /** * Image name */ readonly name: string; /** * Image base URL */ readonly imageBaseURL: string; /** * Image URL */ readonly url: string; /** * Image type */ readonly imageType: string | null; /** * Image URL of mihoyo */ readonly mihoyoURL: string; /** * Classes for handling images * @param name Image name * @param url Image URL(Basically, no need to specify) */ constructor(name: string, url?: string); /** * Create a ImageAssets instance from the image URL * @param url Image URL * @returns ImageAssets instance */ static fromURL(url: string): ImageAssets; /** * Classes for handling images * @param option Client option */ static deploy(option: ClientOption): void; /** * Fetch image buffer * @returns Image buffer */ fetchBuffer(): Promise<Buffer>; /** * Fetch image stream * @param highWaterMark HighWaterMark * @returns Image stream */ fetchStream(highWaterMark?: number): Promise<fs.ReadStream>; /** * Check if the PNG file is corrupted * @warning This function is not perfect, so it may not be able to detect all corrupted files. because it only checks the PNG signature and IEnd chunk. * @param filePath File path * @returns is PNG file corrupted */ private isPNGCorrupted; }