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
- Last updated: Mon, 20 Nov 2023 23:36:24 GMT
- Dependencies: @types/needle, @types/node
Credits
These definitions were written by Jinesh Shah, and Piotr Błażejewicz.