mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
Add types for gzip-js (#22752)
This commit is contained in:
parent
5e0afb0d2e
commit
4c11f21e74
16
types/gzip-js/gzip-js-tests.ts
Normal file
16
types/gzip-js/gzip-js-tests.ts
Normal file
@ -0,0 +1,16 @@
|
||||
import * as gz from 'gzip-js';
|
||||
|
||||
const options = {
|
||||
level: 3,
|
||||
name: 'hello-world.txt',
|
||||
timestamp: Date.now() / 1000,
|
||||
};
|
||||
|
||||
const out = Buffer.from(gz.zip('Hello world', options));
|
||||
console.log(out);
|
||||
|
||||
let buf;
|
||||
buf = Buffer.from(gz.unzip([42, 42, 42]));
|
||||
buf = Buffer.from(gz.unzip(Buffer.from([42, 42, 42])));
|
||||
buf = Buffer.from(gz.unzip(new Uint8Array([42, 42, 42])));
|
||||
console.log(buf.toString());
|
||||
15
types/gzip-js/index.d.ts
vendored
Normal file
15
types/gzip-js/index.d.ts
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
// Type definitions for gzip-js 0.3
|
||||
// Project: https://github.com/beatgammit/gzip-js
|
||||
// Definitions by: rhysd <https://github.com/rhysd>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
export interface ZipOptions {
|
||||
level?: number;
|
||||
name?: string;
|
||||
timestamp?: number;
|
||||
}
|
||||
export function zip(data: string, opts?: ZipOptions): number[];
|
||||
export function unzip(data: number[] | Buffer | Uint8Array): number[];
|
||||
export const DEFAULT_LEVEL: number;
|
||||
23
types/gzip-js/tsconfig.json
Normal file
23
types/gzip-js/tsconfig.json
Normal file
@ -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",
|
||||
"gzip-js-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/gzip-js/tslint.json
Normal file
1
types/gzip-js/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Loading…
Reference in New Issue
Block a user