mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-12 13:00:19 +00:00
add typings for node-gzip (#36560)
This commit is contained in:
committed by
Ryan Cavanaugh
parent
c2aed2dcf2
commit
49bdfca832
Vendored
+13
@@ -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>;
|
||||
@@ -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');
|
||||
};
|
||||
@@ -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"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user