Skip to content

Interfaces

Drazail edited this page Oct 31, 2020 · 3 revisions

CONSTANTS


HashAlgorithms : Record<string, string>;
HmacAlgorithms : Record<string, string>;
Events : Record<string, string>;

API


hashFile(uri: string, algorithm: string): Promise<string>;
/**
 * 
 * @param uri uri pointing to File or directory
 * @param algorithm algorithm to be used for hashing
 * @param minFileSize minimum file size to be hashed in bytes
 * @param maxFileSize maximum file size to be hashed in bytes
 * @param extensionFilter extension of files to be hashed, pass "" to ignore this option
 * @param batchSize event batch size, pass -1 to retrieve all results on .then instead of events
 * @returns Promise -- if batchSize is set to -1, the promise.resolve contains all the hashes, otherwise, it resolves to null.
 */
hashFilesForFolder(
    uri: string, algorithm: string, minFileSize: number, maxFileSize: number, extensionFilter: string, batchSize: number, delay: number
): Promise<{ FilesCount: number, isFinalBatch: bool, batchNumber: number, results: Record<string, string> }>;
hashFilesForFolders(
    uri: Array<string>, algorithm: string, minFileSize: number, maxFileSize: number, extensionFilter: string, batchSize: number, delay: number
): Promise<{ FilesCount: number, isFinalBatch: bool, batchNumber: number, results: Record<string, string> }>;
hashUrl(url: string, HTTPMethod: string, headers: Record<string, string>, algorithm: string): Promise<string>;
hashString(message: string, algorithm: string): Promise<string>;
generateHmac(message: string, key: string, algorithm: string): Promise<string>;

namespace CONSTANTS {
    namespace HashAlgorithms {
        md2: string;
        export const md5: String;
        export const sha1: String;
        export const sha224: String;
        export const sha256: String;
        export const sha384: String;
        export const sha512: String;
        export const keccak: String;
    }
    namespace HmacAlgorithms {
        HmacMD5: String;
        HmacSHA1: String;
        HmacSHA224: String;
        HmacSHA256: String;
        HmacSHA384: String;
        HmacSHA512: String;
        PBEwithHmacSHA: String;
        PBEwithHmacSHA1: String;
        PBEwithHmacSHA224: String;
        PBEwithHmacSHA256: String;
        PBEwithHmacSHA384: String;
        PBEwithHmacSHA512: String;
    }
    namespace Events {
        onBatchReccieved: String;
    }
}
namespace JSHash {
    hashString(message: string, algorithm: string): Promise<string>;
}
namespace JSHmac {
    hashString(message: string, secret: string, algorithm: string): Promise<string>;
}
Clone this wiki locally