JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 44955
  • Score
    100M100P100Q161693F
  • License MIT

TypeScript definitions for probe-image-size

Package Exports

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@types/probe-image-size) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    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

    /// <reference types="node" />
    
    import needle = require("needle");
    import { Transform } from "stream";
    
    /**
     * Get image size without full download. Supported image types: JPG, GIF, PNG, WebP, BMP, TIFF, SVG, PSD.
     */
    declare function probe(source: string, opts?: needle.NeedleOptions): Promise<probe.ProbeResult>;
    declare function probe(source: NodeJS.ReadableStream, keepOpen?: boolean): Promise<probe.ProbeResult>;
    
    declare class ProbeError extends Error {
        constructor(
            message: string,
            code?: "ECONTENT" | null,
            statusCode?: number,
        );
    }
    
    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;
        }
    
        const Error: typeof ProbeError;
    
        function sync(data: Buffer): ProbeResult | null;
    
        // eslint-disable-next-line @typescript-eslint/no-empty-interface
        interface ParserStream extends Transform {}
    
        type Parser = () => ParserStream;
    
        interface Parsers {
            avif: Parser;
            bmp: Parser;
            gif: Parser;
            ico: Parser;
            jpeg: Parser;
            png: Parser;
            psd: Parser;
            svg: Parser;
            tiff: Parser;
            webp: Parser;
        }
    
        const parsers: Parsers;
    }
    
    export = probe;
    

    Additional Details

    Credits

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