Async write.

@param string $data Data to write

@return Promise
421340
public function bufferWrite(string $data): Promise
    {
        if ($this->append_after) {
            $this->append_after -= strlen($data);
            if ($this->append_after === 0) {
                $data .= $this->append;
                $this->append = '';
            } elseif ($this->append_after < 0) {
                $this->append_after = 0;
                $this->append = '';

                throw new Exception('Tried to send too much out of frame data, cannot append');
            }
        }

        return $this->write($data);
    }
586222
public function put($data)
    {
        $this->data = array_merge($this->data, $data);
        return $this->save();
    }
214515
protected function _write($data) {
		if (!$this->connected) {
			$message = 'No connecting found while writing data to socket.';
			throw new RuntimeException($message);
		}

		$data .= "\r\n";
		return fwrite($this->_connection, $data, strlen($data));
	}
728606
public function write($data)
	{
		$this->createFolderIfNotExist($this->folderPath());
		$this->createFile($this->getFilePath(), $data);
	}
1032146
function write(drizzleData) {
  return Promise.all([
    writePages(drizzleData),
    writeCollections(drizzleData)
  ]).then(
    () => drizzleData,
    error => DrizzleError.error(error, drizzleData.options)
  );
}
32400
public function appendData(string $data): self
    {
        if (empty($this->nodes)) {
            $prevHash = $this->firstPrevHash;
        } else {
            $last = $this->getLastNode();
            $prevHash = $last->getHash(true);
        }
        $newNode = new Node($data, $prevHash);
        $this->nodes[] = $newNode;

        SodiumCompat::crypto_generichash_update(
            $this->summaryHashState,
            $newNode->getHash(true)
        );
        return $this;
    }
1089440
public function writeLine(string $data): void
	{
		try
		{
			$this->write($data."\r\n");
		}
		catch (\Exception $e)
		{
			throw $e;
		}
	}
336406
public function write($data)
    {
        if ($this->deadline) {
            stream_set_timeout($this->socket, max($this->deadline - time(), 1));
        }
        $written = fwrite($this->socket, $data);
        $this->checkTimeout();
        // http://www.php.net/manual/en/function.fwrite.php#96951
        if ($written < mb_strlen($data, '8bit')) {
            throw new Net_Notifier_Socket_ConnectionException(
                'Error writing request'
            );
        }
        return $written;
    }
490601
protected function handleDispatch($data)
    {
        if (! is_null($hData = $this->handlers->getHandler($data->t))) {
            $handler = new $hData['class'](
                $this->http,
                $this->factory,
                $this->cache,
                $this
            );

            $deferred = new Deferred();
            $deferred->promise()->then(function ($d) use ($data, $hData) {
                if (is_array($d) && count($d) == 2) {
                    list($new, $old) = $d;
                } else {
                    $new = $d;
                    $old = null;
                }

                $this->emit($data->t, [$new, $this, $old]);

                foreach ($hData['alternatives'] as $alternative) {
                    $this->emit($alternative, [$d, $this]);
                }

                if ($data->t == Event::MESSAGE_CREATE && mentioned($this->client->user, $new)) {
                    $this->emit('mention', [$new, $this, $old]);
                }
            }, function ($e) use ($data) {
                $this->logger->warning('error while trying to handle dispatch packet', ['packet' => $data->t, 'error' => $e]);
            }, function ($d) use ($data) {
                $this->logger->warning('notified from event', ['data' => $d, 'packet' => $data->t]);
            });

            $parse = [
                Event::GUILD_CREATE,
            ];

            if (! $this->emittedReady && (array_search($data->t, $parse) === false)) {
                $this->unparsedPackets[] = function () use (&$handler, &$deferred, &$data) {
                    $handler->handle($deferred, $data->d);
                };
            } else {
                $handler->handle($deferred, $data->d);
            }
        }

        $handlers = [
            Event::VOICE_SERVER_UPDATE => 'handleVoiceServerUpdate',
            Event::RESUMED             => 'handleResume',
            Event::READY               => 'handleReady',
            Event::GUILD_MEMBERS_CHUNK => 'handleGuildMembersChunk',
            Event::VOICE_STATE_UPDATE  => 'handleVoiceStateUpdate',
        ];

        if (isset($handlers[$data->t])) {
            $this->{$handlers[$data->t]}($data);
        }
    }
1335220
public function write($data)
    {
        if (!$this->connected) {
            if (!$this->connect()) {
                return false;
            }
        }
        return fwrite($this->connection, $data, strlen($data));
    }
1324206
public function bufferWrite(string $data): Promise
    {
        if ($this->append_after) {
            $this->append_after -= strlen($data);
            if ($this->append_after === 0) {
                $data .= $this->append;
                $this->append = '';
            } elseif ($this->append_after < 0) {
                $this->append_after = 0;
                $this->append = '';

                throw new Exception('Tried to send too much out of frame data, cannot append');
            }
        }

        return $this->write_buffer->bufferWrite(@$this->encrypt->encrypt($data));
    }
675232
public function write($data = null)
    {
        $this->response = $this->httpClient->post($this->parameters['url'], $this->getRequestParameters($data));
    }
1324808
public function write(Request $request, Response $response): Promise
    {
        if ($this->http2) {
            return $this->http2->write($request, $response);
        }

        return $this->lastWrite = new Coroutine($this->send($response, $request));
    }
67987
public function writeText(string $data): XmlStreamWriter
    {
        return $this->append(
                function(\DOMNode $parent) use ($data)
                {
                    $parent->appendChild(
                            $this->doc->createTextNode($this->encode($data))
                    );
                },
                'text'
        );
    }
836917
public function overwrite($data)
    {
        $body = $this->getBody();
        $body->rewind();
        $body->write($data);

        return $this;
    }
1173825
public function broadcast($data): Promise
    {
        $promises = [];
        /** @var Internal\IpcParent $worker */
        foreach ($this->workers as $worker) {
            $promises[] = $worker->send($data);
        }
        return Promise\all($promises);
    }
625844
public function write($data)
	{
		$history = new Pheanstalk_Socket_WriteHistory(self::WRITE_RETRIES);

		for ($written = 0, $fwrite = 0; $written < strlen($data); $written += $fwrite)
		{
			$fwrite = $this->_wrapper()
				->fwrite($this->_socket, substr($data, $written));

			$history->log($fwrite);

			if ($history->isFullWithNoWrites())
			{
				throw new Pheanstalk_Exception_SocketException(sprintf(
					'fwrite() failed to write data after %d tries',
					self::WRITE_RETRIES
				));
			}
		}
	}