MCPcopy Create free account
hub / github.com/vercel/vercel / hashFile

Function hashFile

packages/client/src/utils/hashes.ts:40–46  ·  view source on GitHub ↗

* Computes the sha1 digest of a file by streaming it, so files too large to fit * in a single Buffer (see MAX_BUFFER_FILE_SIZE) can still be hashed.

(path: string)

Source from the content-addressed store, hash-verified

38 * in a single Buffer (see {@link MAX_BUFFER_FILE_SIZE}) can still be hashed.
39 */
40async function hashFile(path: string): Promise<string> {
41 const digest = createHash('sha1');
42 for await (const chunk of fs.createReadStream(path)) {
43 digest.update(Uint8Array.from(chunk as Buffer));
44 }
45 return digest.digest('hex');
46}
47
48/**
49 * Transforms map to object

Callers 1

hashesFunction · 0.70

Calls 2

createReadStreamMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected