7.2.4 • Published 6 months ago

@types/probe-image-size v7.2.4

Weekly downloads
6,143
License
MIT
Repository
github
Last release
6 months ago

Installation

npm install --save @types/probe-image-size

Summary

This package contains type definitions for probe-image-size (https://github.com/nodeca/probe-image-size#readme).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/probe-image-size.

index.d.ts

// Type definitions for probe-image-size 7.0
// Project: https://github.com/nodeca/probe-image-size#readme
// Definitions by: Jinesh Shah <https://github.com/jineshshah36>
//                 Piotr Błażejewicz <https://github.com/peterblazejewicz>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />

/**
 * Get image size without full download. Supported image types: JPG, GIF, PNG, WebP, BMP, TIFF, SVG, PSD.
 */
declare function probe(source: string, opts: probe.ProbeOptions, callback: probe.ProbeCallback): void;
declare function probe(source: string, opts?: probe.ProbeOptions): Promise<probe.ProbeResult>;
declare function probe(source: string | NodeJS.ReadableStream, callback: probe.ProbeCallback): void;
declare function probe(source: NodeJS.ReadableStream): Promise<probe.ProbeResult>;

declare namespace probe {
    interface ProbeResult {
        width: number;
        height: number;
        length: number;
        type: string;
        mime: string;
        wUnits: string;
        hUnits: string;
        url: string;
        orientation?: Orientation | undefined;
        variants?: Variant[] | undefined;
    }

    type Orientation = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8;

    interface Variant {
        width: number;
        height: number;
    }

    interface ProbeOptions {
        retries?: number | undefined;
        timeout?: number | undefined;
    }

    interface ProbeError extends Error {
        code?: "ECONTENT" | undefined;
        status?: number | undefined;
    }

    type ProbeCallback = (err: ProbeError | null, result: ProbeResult) => void;

    function sync(data: Buffer): ProbeResult | null;
}

export = probe;

Additional Details

  • Last updated: Thu, 08 Jul 2021 20:19:50 GMT
  • Dependencies: @types/node
  • Global values: none

Credits

These definitions were written by Jinesh Shah, and Piotr Błażejewicz.

7.2.4

6 months ago

7.2.3

6 months ago

7.2.2

7 months ago

7.2.1

8 months ago

7.2.0

2 years ago

7.0.1

3 years ago

7.0.0

3 years ago

5.0.1

4 years ago

5.0.0

4 years ago