@e-mc/image
TypeScript icon, indicating that this package has built-in type declarations

0.8.7 • Public • Published

@e-mc/image

  • NodeJS 14
  • ES2020

General Usage

Interface

import type { IHost, ModuleConstructor } from "./index";
import type { IFileThread } from "./asset";
import type { CommandData, CropData, QualityData, ResizeData, RotateData, TransformOptions } from "./image";
import type { ImageModule } from "./settings";

interface IImage extends IClient<IHost, ImageModule> {
    resizeData?: ResizeData;
    cropData?: CropData;
    rotateData?: RotateData;
    qualityData?: QualityData;
    methodData?: [string, unknown[]?][];
    opacityValue?: number;
    setCommand(value: string | CommandData, outputAs?: string): void;
    getCommand(): string;
    parseCommand(value: string): CommandData;
    parseMethod(value: string): [string, unknown[]?][] | undefined;
    parseResize(value: string): ResizeData | undefined;
    parseCrop(value: string): CropData | undefined;
    parseRotate(value: string): RotateData | undefined;
    parseQuality(value: string): QualityData | undefined;
    parseOpacity(value: string): number;
    using?(data: IFileThread, command: string): Promise<unknown>;
    get outputAs(): string;
}

interface ImageConstructor extends ModuleConstructor {
    readonly REGEXP_SIZERANGE: RegExp;
    transform(file: string, command: string, options?: TransformOptions): Promise<Buffer | string | null>;
    clamp(value: unknown, min?: number, max?: number): number;
    isBinary(mime: unknown): mime is string;
    toABGR(buffer: Uint8Array | Buffer): Buffer;
    /* @deprecated - IImage.using */
    using?(this: IHost, instance: IImage, data: IFileThread, command: string): Promise<unknown>;
    readonly prototype: IImage;
    new(module?: ImageModule): IImage;
}

References

LICENSE

BSD 3-Clause

Package Sidebar

Install

npm i @e-mc/image

Weekly Downloads

2

Version

0.8.7

License

BSD 3-Clause

Unpacked Size

20.1 kB

Total Files

6

Last publish

Collaborators

  • anpham6