Skip to main content
Deno.Conn.write - Deno documentation
method Deno.Conn.write
Conn.write(p: Uint8Array): Promise<number>

Write the contents of the array buffer (p) to the connection.

Resolves to the number of bytes written.

It is not guaranteed that the full buffer will be written in a single call.

const conn = await Deno.connect({ hostname: "example.com", port: 80 });
const encoder = new TextEncoder();
const data = encoder.encode("Hello world");
const bytesWritten = await conn.write(data); // 11

Parameters

p: Uint8Array

Return Type

Promise<number>