diff --git a/src/compression/basedecoder.js b/src/compression/basedecoder.js index 1d5b8b42..5426920d 100644 --- a/src/compression/basedecoder.js +++ b/src/compression/basedecoder.js @@ -1,8 +1,8 @@ import { applyPredictor } from '../predictor'; export default class BaseDecoder { - decode(fileDirectory, buffer) { - const decoded = this.decodeBlock(buffer); + async decode(fileDirectory, buffer) { + const decoded = await this.decodeBlock(buffer); const predictor = fileDirectory.Predictor || 1; if (predictor !== 1) { const isTiled = !fileDirectory.StripOffsets; diff --git a/src/decoder.worker.js b/src/decoder.worker.js index 5529d720..9c09beaf 100644 --- a/src/decoder.worker.js +++ b/src/decoder.worker.js @@ -1,9 +1,10 @@ import { expose, Transfer } from 'threads/worker'; import { getDecoder } from './compression'; -function decode(fileDirectory, buffer) { +async function decode(fileDirectory, buffer) { const decoder = getDecoder(fileDirectory); - return Transfer(decoder.decode(fileDirectory, buffer)); + const decoded = await decoder.decode(fileDirectory, buffer); + return Transfer(decoded); } expose(decode);