add browser dist

This commit is contained in:
Metazla
2024-04-08 16:13:08 +02:00
parent 14ba90f521
commit 6123e10c07
67 changed files with 538 additions and 254 deletions
+17
View File
@@ -0,0 +1,17 @@
import {CID_ALGORITHM_NAMES} from "@root/hash-compute/MultiHashData";
import fs from "fs";
import {computeCIDs as computeCIDsInternal} from "./ComputeHash";
/**
* Compute the CIDs of a file using specific algorithms
* @param filePath The path to the file
* @param algorithms Array of algorithms ('sha256', 'sha1')
* @returns Array of CIDs (in the order of the algorithms)
*/
export default async function computeCIDs({filePath, algorithms}: {
filePath: string;
algorithms: CID_ALGORITHM_NAMES[]
}): Promise<string[]> {
const stream = fs.createReadStream(filePath);
return computeCIDsInternal({stream, algorithms});
}