public function buffer(Context $context): Promise
    {
        return $context->task(function (Context $context) {
            $buffer = '';
            
            try {
                while (null !== ($chunk = yield $this->read($context, 0xFFFF))) {
                    $buffer .= $chunk;
                }
            } finally {
                $this->close();
            }
            
            return $buffer;
        });
    }