diff --git a/lib/core/codec-worker.js b/lib/core/codec-worker.js index bad4c8df..59f04ef7 100644 --- a/lib/core/codec-worker.js +++ b/lib/core/codec-worker.js @@ -100,9 +100,9 @@ class ProgressWatcherStream extends TransformStream { constructor(readableSource, { onstart, onprogress, size, onend }) { let chunkOffset = 0; super({ - start() { + async start() { if (onstart) { - callHandler(onstart, size); + await callHandler(onstart, size); } }, async transform(chunk, controller) { @@ -112,10 +112,10 @@ class ProgressWatcherStream extends TransformStream { } controller.enqueue(chunk); }, - flush() { + async flush() { readableSource.size = chunkOffset; if (onend) { - callHandler(onend, chunkOffset); + await callHandler(onend, chunkOffset); } } });