checkForChunks() {
    if (!this.position) {
      this.position = 8;
    }

    while (true) {
      // Check if stream contains another PNG chunk
      const dataView = new DataView(this.data.buffer, this.position);
      const chunkLength = dataView.getUint32(0);
      if (dataView.byteLength < chunkLength + 12) {
        return;
      }

      // Create a PNG chunk instance out of data retrieved
      const name = String.fromCharCode(dataView.getUint8(4), dataView.getUint8(5), dataView.getUint8(6), dataView.getUint8(7));
      const data = this.data.buffer.slice(this.position + 8, this.position + chunkLength + 8);
      const chunk = createChunk({ name, data });

      // Inform consumer about the found chunk
      if (typeof this.onChunk === 'function') {
        this.onChunk(chunk);
      }

      // Check if found the last chunk within the PNG
      if (name === 'IEND') {
        if (typeof this.onClose === 'function') {
          this.onClose();
          return;
        }
      }

      this.position += chunkLength + 12;
    }
  }
Checks whether new chunks can be found within the binary data.