UNPKG

node-font2base64

Version:

Convert font to base64 url or src, and to inject src into style files

73 lines (71 loc) 3.88 kB
/*! * node-font2base64 * Copyright(c) 2023 Junmin Ahn * MIT Licensed */ declare const encodeToDataUrl: (fpath: string) => Promise<string | string[]>; declare const encodeToDataUrlSync: (fpath: string) => string | string[]; declare const encodeToDataSrc: (fpath: string) => Promise<string | null> | Promise<(string | null)[]>; declare const encodeToDataSrcSync: (fpath: string) => string | (string | null)[] | null; interface CssAstUpdateResult { modified: boolean; content?: string; filepath?: string; } declare const injectBase64: { (fpath: string, cpath: string, { validator, fontTypes, cssTypes, resave, fullpathMatch, }?: { validator?: ((path1: string, path2: string) => boolean) | undefined; fontTypes?: string[] | undefined; cssTypes?: string[] | undefined; resave?: boolean | undefined; fullpathMatch?: boolean | undefined; }): Promise<true | CssAstUpdateResult[]>; fromContent(fpath: string, content: string, { validator, fontTypes, fullpathMatch, root }?: FromContentOptions): Promise<CssAstUpdateResult>; fromBuffer(fpath: string, buffer: Buffer, options?: FromContentOptions): Promise<CssAstUpdateResult>; }; declare const injectBase64Sync: { (fpath: string, cpath: string, { validator, fontTypes, cssTypes, resave, fullpathMatch, }?: { validator?: ((path1: string, path2: string) => boolean) | undefined; fontTypes?: string[] | undefined; cssTypes?: string[] | undefined; resave?: boolean | undefined; fullpathMatch?: boolean | undefined; }): true | CssAstUpdateResult[]; fromContent(fpath: string, content: string, { validator, fontTypes, fullpathMatch, root }?: FromContentOptions): CssAstUpdateResult; fromBuffer(fpath: string, buffer: Buffer, options?: FromContentOptions): CssAstUpdateResult; }; interface FromContentOptions { validator?: (path1: string, path2: string) => boolean; fontTypes?: string[]; fullpathMatch?: boolean; root?: string; } declare const _default: { encodeToDataUrl: (fpath: string) => Promise<string | string[]>; encodeToDataSrc: (fpath: string) => Promise<string | null> | Promise<(string | null)[]>; encodeToDataUrlSync: (fpath: string) => string | string[]; encodeToDataSrcSync: (fpath: string) => string | (string | null)[] | null; injectBase64: { (fpath: string, cpath: string, { validator, fontTypes, cssTypes, resave, fullpathMatch, }?: { validator?: ((path1: string, path2: string) => boolean) | undefined; fontTypes?: string[] | undefined; cssTypes?: string[] | undefined; resave?: boolean | undefined; fullpathMatch?: boolean | undefined; }): Promise<true | CssAstUpdateResult[]>; fromContent(fpath: string, content: string, { validator, fontTypes, fullpathMatch, root }?: FromContentOptions): Promise<CssAstUpdateResult>; fromBuffer(fpath: string, buffer: Buffer, options?: FromContentOptions | undefined): Promise<CssAstUpdateResult>; }; injectBase64Sync: { (fpath: string, cpath: string, { validator, fontTypes, cssTypes, resave, fullpathMatch, }?: { validator?: ((path1: string, path2: string) => boolean) | undefined; fontTypes?: string[] | undefined; cssTypes?: string[] | undefined; resave?: boolean | undefined; fullpathMatch?: boolean | undefined; }): true | CssAstUpdateResult[]; fromContent(fpath: string, content: string, { validator, fontTypes, fullpathMatch, root }?: FromContentOptions): CssAstUpdateResult; fromBuffer(fpath: string, buffer: Buffer, options?: FromContentOptions | undefined): CssAstUpdateResult; }; }; export { _default as default, encodeToDataSrc, encodeToDataSrcSync, encodeToDataUrl, encodeToDataUrlSync, injectBase64, injectBase64Sync };