UNPKG

@ayonli/jsext

Version:

A JavaScript extension package for building strong and modern applications.

40 lines (39 loc) 1.21 kB
/** * Returns the corresponding UTI (Uniform Type Identifier) for the given * type, where the type is a file extension or a MIME type name. * * @example * ```ts * import { getUTI } from "@ayonli/jsext/filetype"; * * console.log(getUTI(".png")); // public.png * console.log(getUTI("image/png")); // public.png * ``` */ export declare function getUTI(type: string): string | undefined; /** * Returns the corresponding MIME type for the given type, where the type is a * file extension or a UTI (Uniform Type Identifier) name. * * @example * ```ts * import { getMIME } from "@ayonli/jsext/filetype"; * * console.log(getMIME(".png")); // image/png * console.log(getMIME("public.png")); // image/png * ``` */ export declare function getMIME(type: string): string | undefined; /** * Returns the corresponding file extensions for the given type, where the type * is a MIME type or a UTI (Uniform Type Identifier) name. * * @example * ```ts * import { getExtensions } from "@ayonli/jsext/filetype"; * * console.log(getExtensions("image/png")); // [".png"] * console.log(getExtensions("public.png")); // [".png"] * ``` */ export declare function getExtensions(type: string): string[];