def METHOD_NAME(blob_task: BlobTask):
    try:
        # It's most efficient to use the same chunk size as the stream
        chunk_size = ByteStreamer.get_chunk_size()
        buf_size = 0
        while True:
            buf = blob_task.stream.read(chunk_size)
            if not buf:
                break
            length = len(buf)
            if blob_task.pre_allocated:
                blob_task.buffer[buf_size : buf_size + length] = buf
            else:
                blob_task.buffer.append(buf)
            buf_size += length
        if blob_task.size and blob_task.size != buf_size:
            log.warning(
                f"Stream {blob_task.future.get_stream_id()} size doesn't match: " f"{blob_task.size} <> {buf_size}"
            )
        if blob_task.pre_allocated:
            result = blob_task.buffer
        else:
            result = blob_task.buffer.to_bytes()
        blob_task.future.set_result(result)
    except Exception as ex:
        log.error(f"Stream {blob_task.future.get_stream_id()} read error: {ex}")
        log.debug(secure_format_traceback())
        blob_task.future.set_exception(ex)