Add types for inflation (#35199)

This commit is contained in:
Remco Haszing
2019-05-04 10:04:17 -07:00
committed by Wesley Wigham
parent 554b193855
commit 7fe167420c
4 changed files with 58 additions and 0 deletions
+27
View File
@@ -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';
}
}
+7
View File
@@ -0,0 +1,7 @@
import { createServer } from 'http';
import * as inflate from 'inflation';
createServer((req, res) => {
inflate(req).pipe(res);
});
+23
View File
@@ -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"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }