How do I compute a digest for a given blob in big size, e.g. 5GB?

I believe the right answer would be to stream the file content instead of reading whole file in memory at once. Blob allows to read a file as a stream:

Now the problem is that Web Cryptography API you're using doesn't support streams or incremental hashing. There is a long (and quite old) discussion about that with no clear outcome: .

I would suggest using some 3rd party library that supports incremental hashing. E.g.

The resulting code could look like

async function calcDigest() {
    const reader = finput.files[0].stream().getReader()
    const shaObj = new jsSHA("SHA-256", "ARRAYBUFFER")

    while (true) {
        const {done, value} = await
        if (done) break