mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
Add typings for checksum-0.1.1.
This commit is contained in:
@@ -51,6 +51,7 @@ All definitions files include a header with the author and editors, so at some p
|
||||
* [bunyan](https://github.com/trentm/node-bunyan) (by [Alex Mikhalev](https://github.com/amikhalev))
|
||||
* [CasperJS](http://casperjs.org) (by [Jed Mao](https://github.com/jedmao))
|
||||
* [CanvasJS](http://canvasjs.com) (by [Mark Overholt](https://github.com/mover5))
|
||||
* [checksum](https://github.com/dshaw/checksum) (by [Rogier Schouten](https://github.com/rogierschouten))
|
||||
* [Cheerio](https://github.com/MatthewMueller/cheerio) (by [Bret Little](https://github.com/blittle))
|
||||
* [Chosen](http://harvesthq.github.com/chosen/) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [Chroma.js](https://github.com/gka/chroma.js) (by [Sebastian Brückner](https://github.com/invliD))
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
/// <reference path="checksum.d.ts" />
|
||||
|
||||
import checksum = require("checksum");
|
||||
|
||||
var s: string = checksum("abcd");
|
||||
var t: string = checksum("abcd", { algorithm: 'sha1' });
|
||||
|
||||
checksum.file("myfile.txt", (error: Error, hash: string): void => {
|
||||
// do nothing
|
||||
});
|
||||
|
||||
checksum.file("myfile.txt", { algorithm: 'sha1' }, (error: Error, hash: string): void => {
|
||||
// do nothing
|
||||
});
|
||||
Vendored
+44
@@ -0,0 +1,44 @@
|
||||
// Type definitions for checksum 0.1.1
|
||||
// Project: https://github.com/dshaw/checksum
|
||||
// Definitions by: Rogier Schouten <https://github.com/rogierschouten>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module "checksum" {
|
||||
|
||||
module checksum {
|
||||
/**
|
||||
* Options object for all functions
|
||||
*/
|
||||
interface ChecksumOptions {
|
||||
/**
|
||||
* Algorithm to use, default 'sha1'
|
||||
* Can be 'sha1' or 'md5' (see module 'crypto').
|
||||
*/
|
||||
algorithm?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the checksum for a file on disk
|
||||
* @param filename The file name
|
||||
* @param callback Callback which is called with the result or an error
|
||||
*/
|
||||
function file(filename: string, callback: (error: Error, hash: string) => void): void;
|
||||
/**
|
||||
* Generate the checksum for a file on disk
|
||||
* @param filename The file name
|
||||
* @param options Options object to indicate hash algo
|
||||
* @param callback Callback which is called with the result or an error
|
||||
*/
|
||||
function file(filename: string, options: ChecksumOptions, callback: (error: Error, hash: string) => void): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a checksum for the given value
|
||||
* @param value Any value
|
||||
* @param options Allows to set the algorithm
|
||||
* @returns Checksum
|
||||
*/
|
||||
function checksum(value: any, options?: checksum.ChecksumOptions): string;
|
||||
|
||||
export = checksum;
|
||||
}
|
||||
Reference in New Issue
Block a user