UNPKG
@produck/json-index-archive
Version:
latest (0.1.3)
0.1.3
0.1.2
0.1.1
0.1.0
@produck/json-index-archive
/
src
/
Archiver
/
Extension
/
integrity.mjs
11 lines
(7 loc)
•
249 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
11
import
*
as
crypto
from
'node:crypto'
;
export
default
async
function
integrity
(
{ readStream, piping }
) {
const
hash = crypto.
createHash
(
'sha256'
); readStream.
on
(
'data'
,
chunk
=>
hash.
update
(chunk));
await
piping;
return
hash.
digest
(
'hex'
); }