diff --git a/web/apps/photos/src/services/upload/uploadService.ts b/web/apps/photos/src/services/upload/uploadService.ts index 4295b6239b..15178b4de0 100644 --- a/web/apps/photos/src/services/upload/uploadService.ts +++ b/web/apps/photos/src/services/upload/uploadService.ts @@ -774,9 +774,18 @@ const computeHash = async ( console.log("got stream and chunks", stream, chunkCount); const hashState = await worker.initChunkHashing(); - const streamReader = stream.getReader(); + const chunkedStream = stream.pipeThrough( + new TransformStream( + undefined, + new ByteLengthQueuingStrategy({ + highWaterMark: ENCRYPTION_CHUNK_SIZE, + }), + ), + ); + const streamReader = chunkedStream.getReader(); for (let i = 0; i < chunkCount; i++) { const { done, value: chunk } = await streamReader.read(); + console.log("chunk size", chunk.length); if (done) throw new Error("Less chunks than expected"); await worker.hashFileChunk(hashState, Uint8Array.from(chunk)); }