UseHashFile
katanakit-js / useHashFile
Function: useHashFile()
Section titled “Function: useHashFile()”function useHashFile(path, algorithm?): Promise<FilesystemResult<string>>;Defined in: infrastructure/filesystem/filesystem.service.ts:173
Streams a file and returns its checksum as a lowercase hex digest.
Parameters
Section titled “Parameters”| Parameter | Type | Default value | Description |
|---|---|---|---|
path |
string |
undefined |
File path. |
algorithm? |
"md5" | "sha1" | "sha256" | "sha512" |
"sha256" |
"md5" | "sha1" | "sha256" | "sha512" (default: "sha256"). |
Returns
Section titled “Returns”Promise<FilesystemResult<string>>
Safe Result with the hex digest.
Example
Section titled “Example”const result = await useHashFile("image.iso"); // sha256const md5 = await useHashFile("image.iso", "md5");