mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-06 07:47:04 +00:00
Add types for inflation (#35199)
This commit is contained in:
committed by
Wesley Wigham
parent
554b193855
commit
7fe167420c
Vendored
+27
@@ -0,0 +1,27 @@
|
||||
// Type definitions for inflation 2.0
|
||||
// Project: https://github.com/stream-utils/inflation#readme
|
||||
// Definitions by: Remco Haszing <https://github.com/remcohaszing>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
import { Readable } from 'stream';
|
||||
import { ZlibOptions } from 'zlib';
|
||||
|
||||
export = inflate;
|
||||
|
||||
/**
|
||||
* Automatically unzip an HTTP stream.
|
||||
*
|
||||
* @returns a stream that emits inflated data from the given stream.
|
||||
*/
|
||||
declare function inflate(req: Readable, options?: inflate.Options): Readable;
|
||||
|
||||
declare namespace inflate {
|
||||
interface Options extends ZlibOptions {
|
||||
/**
|
||||
* The encoding of the stream. If not given, will look in `stream.headers['content-encoding']`.
|
||||
*/
|
||||
gzip?: 'deflate' | 'gzip' | 'identity';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
import { createServer } from 'http';
|
||||
|
||||
import * as inflate from 'inflation';
|
||||
|
||||
createServer((req, res) => {
|
||||
inflate(req).pipe(res);
|
||||
});
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"strictFunctionTypes": true,
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"inflation-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user