add typings for node-gzip (#36560)

This commit is contained in:
mike castleman
2019-07-01 11:14:45 -07:00
committed by Ryan Cavanaugh
parent c2aed2dcf2
commit 49bdfca832
4 changed files with 53 additions and 0 deletions
+13
View File
@@ -0,0 +1,13 @@
// Type definitions for node-gzip 1.1
// Project: https://github.com/Rebsos/node-gzip#readme
// Definitions by: mike castleman <https://github.com/mlc>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.1
/// <reference types="node" />
import { InputType, ZlibOptions } from 'zlib';
export function gzip(input: InputType, options?: ZlibOptions): Promise<Buffer>;
export function ungzip(input: InputType, options?: ZlibOptions): Promise<Buffer>;
+16
View File
@@ -0,0 +1,16 @@
import { gzip, ungzip } from 'node-gzip';
const testGzip = async () => {
const someBuffer = Buffer.from('hello');
const zipped1 = await gzip(someBuffer);
const zipped2 = await gzip('gzipping a string directly');
return [zipped1.byteLength, zipped2[0]];
};
const testUngzip = async () => {
const data = Buffer.from('H4sICHeEGV0AA2EA4wIAkwbXMgEAAAA=', 'base64');
const ungzipped = await ungzip(data);
return ungzipped.toString('utf-8');
};
+23
View File
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"node-gzip-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }