mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
[check-sum] add typings
This commit is contained in:
parent
7ad5650b35
commit
4b9d24bceb
18
types/check-sum/check-sum-tests.ts
Normal file
18
types/check-sum/check-sum-tests.ts
Normal file
@ -0,0 +1,18 @@
|
||||
import checksum = require('check-sum');
|
||||
import * as fs from 'fs';
|
||||
|
||||
const stream = fs.createReadStream('package.json');
|
||||
|
||||
checksum(stream, {
|
||||
md5: 'asdfasdfasdf',
|
||||
sha1: 'asdfasdfasdf'
|
||||
}, err => {
|
||||
err; // $ExpectType any
|
||||
});
|
||||
|
||||
checksum('package.json', {
|
||||
md5: 'asdfasdfasdf',
|
||||
sha1: 'asdfasdfasdf'
|
||||
}, err => {
|
||||
err; // $ExpectType Error | ChecksumError | undefined
|
||||
});
|
||||
24
types/check-sum/index.d.ts
vendored
Normal file
24
types/check-sum/index.d.ts
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
// Type definitions for check-sum 0.1
|
||||
// Project: https://github.com/stream-utils/check-sum
|
||||
// Definitions by: BendingBender <https://github.com/BendingBender>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node" />
|
||||
import { Readable } from 'stream';
|
||||
|
||||
export = checksum;
|
||||
|
||||
declare function checksum(stream: Readable, hashes: checksum.Hashes, callback: (error: checksum.ChecksumError | any) => void): (fn: () => void) => void;
|
||||
declare function checksum(path: string, hashes: checksum.Hashes, callback: (error: checksum.ChecksumError | Error | undefined) => void): (fn: () => void) => void;
|
||||
|
||||
declare namespace checksum {
|
||||
interface ChecksumError {
|
||||
algorithm: string;
|
||||
expected: string;
|
||||
actual: string;
|
||||
}
|
||||
|
||||
interface Hashes {
|
||||
[algorithm: string]: string | Buffer;
|
||||
}
|
||||
}
|
||||
22
types/check-sum/tsconfig.json
Normal file
22
types/check-sum/tsconfig.json
Normal file
@ -0,0 +1,22 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"check-sum-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/check-sum/tslint.json
Normal file
1
types/check-sum/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Loading…
Reference in New Issue
Block a user