Options
All
  • Public
  • Public/Protected
  • All
Menu

Module index

Index

Type aliases

IMatcherFunction

IMatcherFunction: (path: string, size: ISize, source: Vinyl) => boolean

Type declaration

    • (path: string, size: ISize, source: Vinyl): boolean
    • Parameters

      • path: string
      • size: ISize
      • source: Vinyl

      Returns boolean

IPostfixFormatter

IPostfixFormatter: (width: number, mul?: number, format?: string) => string

Type declaration

    • (width: number, mul?: number, format?: string): string
    • Parameters

      • width: number
      • Optional mul: number
      • Optional format: string

      Returns string

Matcher

Matcher: string | IMatcherFunction

There is support of 3 types of matchers:

  1. Glob pattern of file path;
  2. Media query to match image by size;
  3. (path: string, size: ISize, source: Vinyl) => boolean function.

Postfix

Postfix: string | IPostfixFormatter

Postfix string or function to generate postfix for image.

SupportedExtension

SupportedExtension: "avif" | "webp" | "jpg" | "png" | "gif" | "svg"

Variables

Const extensions

extensions: { avif: RegExp; gif: RegExp; jpg: RegExp; png: RegExp; svg: RegExp; webp: RegExp } = ...

Type declaration

  • avif: RegExp
  • gif: RegExp
  • jpg: RegExp
  • png: RegExp
  • svg: RegExp
  • webp: RegExp

Functions

attachMetadata

  • attachMetadata(source: Vinyl, force?: boolean): Promise<ISrcSetVinyl>
  • Attach image metadata to the vinyl file.

    Parameters

    • source: Vinyl

      Image file.

    • force: boolean = false

      Force refetch metadata.

    Returns Promise<ISrcSetVinyl>

    Source image file with attached metadata.

cloneSrcSetVinyl

cuncurrentIterator

  • cuncurrentIterator<TItem, TData>(items: TItem[], handler: IteratorHandler<TItem, TData>, concurrency?: number): { [Symbol.asyncIterator]: any }
  • Type parameters

    • TItem

    • TData

    Parameters

    • items: TItem[]
    • handler: IteratorHandler<TItem, TData>
    • concurrency: number = ...

    Returns { [Symbol.asyncIterator]: any }

    • [Symbol.asyncIterator]: function
      • [Symbol.asyncIterator](): AsyncGenerator<TData, void, undefined>

getFormat

isSupportedType

  • isSupportedType(type: string): boolean
  • Check image type

    Parameters

    • type: string

      Image extension without dot.

    Returns boolean

    Image type is supported or not.

isVinylBuffer

  • isVinylBuffer(source: Vinyl): boolean
  • Check object is Vinyl-buffer.

    Parameters

    • source: Vinyl

      Object to check.

    Returns boolean

    Result.

matchImage

  • Match image file by path and size

    Parameters

    Returns Promise<boolean>

    Image is matched or not.

Generated using TypeDoc