_ensure (size) {
    const toWriteSize = this._chunkOpen ? size : size + _CHUNK_HEADER_SIZE
    if (this._buffer.remaining() < toWriteSize) {
      this.flush()
    }

    if (!this._chunkOpen) {
      this._currentChunkStart = this._buffer.position
      this._buffer.position = this._buffer.position + _CHUNK_HEADER_SIZE
      this._chunkOpen = true
    }
  }
Ensure at least the given size is available for writing