MCPcopy
hub / github.com/prisma/prisma / getHash

Function getHash

packages/fetch-engine/src/getHash.ts:4–17  ·  view source on GitHub ↗
(filePath: string)

Source from the content-addressed store, hash-verified

2import fs from 'node:fs'
3
4export function getHash(filePath: string): Promise<string> {
5 const hash = crypto.createHash('sha256')
6 const input = fs.createReadStream(filePath)
7 return new Promise((resolve) => {
8 input.on('readable', () => {
9 const data = input.read()
10 if (data) {
11 hash.update(data)
12 } else {
13 resolve(hash.digest('hex'))
14 }
15 })
16 })
17}

Callers 1

Calls 5

readMethod · 0.80
digestMethod · 0.80
onMethod · 0.65
resolveFunction · 0.50
updateMethod · 0.45

Tested by

no test coverage detected