-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathindex.d.ts
More file actions
42 lines (37 loc) · 1000 Bytes
/
index.d.ts
File metadata and controls
42 lines (37 loc) · 1000 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/// <reference types="node" />
export interface Header {
'Content-Type'?: string
'Content-Encoding'?: string
}
export type extensions = 'png' | 'pbf' | 'jpg' | 'webp'
/**
* Given a buffer of unknown data, return either a format as an extension
* string or false if the type cannot be determined.
*
* Potential options are:
*
* * png
* * pbf
* * jpg
* * webp
*
* @param {Buffer} buffer input
* @returns {String|boolean} identifier
*/
export function type(buffer: Buffer): extensions | boolean
/**
* Return headers - Content-Type and Content-Encoding -
* for a response containing this kind of image.
*
* @param {Buffer} buffer input
* @returns {Object} headers
*/
export function headers(buffer: Buffer): Header
/**
* Determine the width and height of an image contained in a buffer,
* returned as a [x, y] array.
*
* @param {Buffer} buffer input
* @returns {Array<number>|boolean} dimensions
*/
export function dimensions(buffer: Buffer): [number, number] | boolean