UNPKG

1.39 kBMarkdownView Raw
1# Installation
2> `npm install --save @types/sha1`
3
4# Summary
5This package contains type definitions for sha1 (https://github.com/pvorb/node-sha1).
6
7# Details
8Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/sha1.
9## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/sha1/index.d.ts)
10````ts
11/// <reference types="node" />
12
13/**
14 * js function for hashing messages with SHA1
15 *
16 * @param message - a string or buffer to hash
17 * @param options - an options object
18 * @returns the resultant SHA1 hash of the given message
19 */
20declare function main(message: string | Buffer, options?: Sha1AsStringOptions): string;
21declare function main(message: string | Buffer, options?: Sha1AsBytesOptions): Uint8Array;
22declare function main(message: string | Buffer, options?: Sha1Options): string | Uint8Array;
23export = main;
24
25interface Sha1AsStringOptions {
26 asBytes?: false | undefined;
27 asString?: boolean | undefined;
28}
29
30interface Sha1AsBytesOptions {
31 asBytes: true;
32 asString?: false | undefined;
33}
34
35type Sha1Options = Sha1AsStringOptions | Sha1AsBytesOptions;
36
37````
38
39### Additional Details
40 * Last updated: Tue, 07 Nov 2023 15:11:36 GMT
41 * Dependencies: [@types/node](https://npmjs.com/package/@types/node)
42
43# Credits
44These definitions were written by [Bill Sourour](https://github.com/arcdev1).
45
\No newline at end of file