Initial import of wrapper-validation-action

This commit is contained in:
daz
2024-04-10 20:43:44 -06:00
parent 3252e655d0
commit f1476a710d
17 changed files with 1709 additions and 95 deletions

View File

@@ -0,0 +1,18 @@
import * as crypto from 'crypto'
import * as fs from 'fs'
export async function sha256File(path: string): Promise<string> {
return new Promise((resolve, reject) => {
const hash = crypto.createHash('sha256')
const stream = fs.createReadStream(path)
stream.on('data', data => hash.update(data))
stream.on('end', () => {
stream.destroy()
resolve(hash.digest('hex'))
})
stream.on('error', error => {
stream.destroy()
reject(error)
})
})
}