mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-05 07:17:04 +00:00
Merge pull request #32269 from BendingBender/is-progressive
[is-progressive] Add types
This commit is contained in:
Vendored
+33
@@ -0,0 +1,33 @@
|
||||
// Type definitions for is-progressive 3.0
|
||||
// Project: https://github.com/sindresorhus/is-progressive#readme
|
||||
// Definitions by: BendingBender <https://github.com/BendingBender>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
import { Readable } from 'stream';
|
||||
|
||||
/**
|
||||
* Returns whether the `buffer` is a progressive JPEG image.
|
||||
* @param buffer Buffer of a JPEG image.
|
||||
* Must be at least `65535` bytes when the file is larger than that.
|
||||
*/
|
||||
export function buffer(buffer: Buffer): boolean;
|
||||
|
||||
/**
|
||||
* Returns a Promise for a boolean indicating whether the file stream is a progressive JPEG image.
|
||||
* @param stream Data stream.
|
||||
*/
|
||||
export function stream(stream: Readable): Promise<boolean>;
|
||||
|
||||
/**
|
||||
* Returns a Promise for a boolean indicating whether the file is a progressive JPEG image.
|
||||
* @param filepath Filepath to the image.
|
||||
*/
|
||||
export function file(filepath: string): Promise<boolean>;
|
||||
|
||||
/**
|
||||
* Returns whether the buffer is a progressive JPEG.
|
||||
* @param filepath Filepath to the image.
|
||||
*/
|
||||
export function fileSync(filepath: string): boolean;
|
||||
@@ -0,0 +1,12 @@
|
||||
import https = require('https');
|
||||
import isProgressive = require('is-progressive');
|
||||
|
||||
isProgressive.file('baseline.jpg'); // $ExpectType Promise<boolean>
|
||||
|
||||
isProgressive.fileSync('progressive.jpg'); // $ExpectType boolean
|
||||
|
||||
https.get('/', res => {
|
||||
isProgressive.stream(res); // $ExpectType Promise<boolean>
|
||||
});
|
||||
|
||||
isProgressive.buffer(new Buffer(1)); // $ExpectType boolean
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"is-progressive-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user