Properties

bool: BoolEnum
fit: FitEnum
format: FormatEnum

Object containing nested boolean values representing the available input and output formats/methods.

gravity: GravityEnum

#endregion

interpolators: Interpolators

An Object containing the available interpolators and their proper values

kernel: KernelEnum
queue: NodeJS.EventEmitter

An EventEmitter that emits a change event when a task is either queued, waiting for libuv to provide a worker thread, complete

strategy: StrategyEnum
versions: {
    avif?: string;
    cairo?: string;
    croco?: string;
    exif?: string;
    expat?: string;
    ffi?: string;
    fontconfig?: string;
    freetype?: string;
    gdkpixbuf?: string;
    gif?: string;
    glib?: string;
    gsf?: string;
    harfbuzz?: string;
    heif?: string;
    jpeg?: string;
    lcms?: string;
    orc?: string;
    pango?: string;
    pixman?: string;
    png?: string;
    sharp?: string;
    svg?: string;
    tiff?: string;
    vips: string;
    webp?: string;
    xml?: string;
    zlib?: string;
}

An Object containing the version numbers of sharp, libvips and its dependencies.

Type declaration

  • Optional avif?: string
  • Optional cairo?: string
  • Optional croco?: string
  • Optional exif?: string
  • Optional expat?: string
  • Optional ffi?: string
  • Optional fontconfig?: string
  • Optional freetype?: string
  • Optional gdkpixbuf?: string
  • Optional gif?: string
  • Optional glib?: string
  • Optional gsf?: string
  • Optional harfbuzz?: string
  • Optional heif?: string
  • Optional jpeg?: string
  • Optional lcms?: string
  • Optional orc?: string
  • Optional pango?: string
  • Optional pixman?: string
  • Optional png?: string
  • Optional sharp?: string
  • Optional svg?: string
  • Optional tiff?: string
  • vips: string
  • Optional webp?: string
  • Optional xml?: string
  • Optional zlib?: string

Methods

  • Block libvips operations at runtime.

    This is in addition to the VIPS_BLOCK_UNTRUSTED environment variable, which when set will block all "untrusted" operations.

    Parameters

    • options: {
          operation: string[];
      }
      • operation: string[]

        List of libvips low-level operation names to block.

    Returns void

    Since

    0.32.4

    Example: Block all TIFF input.

    sharp.block({
    operation: ['VipsForeignLoadTiff']
    });
  • Gets or, when options are provided, sets the limits of libvips' operation cache. Existing entries in the cache will be trimmed after any change in limits. This method always returns cache statistics, useful for determining how much working memory is required for a particular task.

    Parameters

    • Optional options: boolean | CacheOptions

      Object with the following attributes, or Boolean where true uses default cache settings and false removes all caching (optional, default true)

    Returns CacheResult

    The cache results.

  • Gets or sets the number of threads libvips' should create to process each image. The default value is the number of CPU cores. A value of 0 will reset to this default. The maximum number of images that can be processed in parallel is limited by libuv's UV_THREADPOOL_SIZE environment variable.

    Parameters

    • Optional concurrency: number

      The new concurrency value.

    Returns number

    The current concurrency value.

  • Provides access to internal task counters.

    Returns SharpCounters

    Object containing task counters

  • Get and set use of SIMD vector unit instructions. Requires libvips to have been compiled with highway support. Improves the performance of resize, blur and sharpen operations by taking advantage of the SIMD vector unit of the CPU, e.g. Intel SSE and ARM NEON.

    Parameters

    • Optional enable: boolean

      enable or disable use of SIMD vector unit instructions

    Returns boolean

    true if usage of SIMD vector unit instructions is enabled

  • Unblock libvips operations at runtime.

    This is useful for defining a list of allowed operations.

    Parameters

    • options: {
          operation: string[];
      }
      • operation: string[]

        List of libvips low-level operation names to unblock.

    Returns void

    Since

    0.32.4

    Example: Block all input except WebP from the filesystem.

    sharp.block({
    operation: ['VipsForeignLoad']
    });
    sharp.unblock({
    operation: ['VipsForeignLoadWebpFile']
    });

    Example: Block all input except JPEG and PNG from a Buffer or Stream.

    sharp.block({
    operation: ['VipsForeignLoad']
    });
    sharp.unblock({
    operation: ['VipsForeignLoadJpegBuffer', 'VipsForeignLoadPngBuffer']
    });

Generated using TypeDoc