Skip to content

UseHashFile

katanakit-js / 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.

Parameter Type Default value Description
path string undefined File path.
algorithm? "md5" | "sha1" | "sha256" | "sha512" "sha256" "md5" | "sha1" | "sha256" | "sha512" (default: "sha256").

Promise<FilesystemResult<string>>

Safe Result with the hex digest.

const result = await useHashFile("image.iso"); // sha256
const md5 = await useHashFile("image.iso", "md5");