Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

Deno.connect

UNSTABLE: The unix socket transport is unstable as a new API yet to be vetted. The TCP transport is considered stable.

Connects to the hostname (default is "127.0.0.1") and port on the named transport (default is "tcp"), and resolves to the connection (Conn).

const conn1 = await Deno.connect({ port: 80 });
const conn2 = await Deno.connect({ hostname: "192.0.2.1", port: 80 });
const conn3 = await Deno.connect({ hostname: "[2001:db8::1]", port: 80 });
const conn4 = await Deno.connect({ hostname: "golang.org", port: 80, transport: "tcp" });
const conn5 = await Deno.connect({ path: "/foo/bar.sock", transport: "unix" });

Requires allow-net permission for "tcp" and allow-read for "unix".

function connect(options: ConnectOptions): Promise<TcpConn>;
function connect(options: UnixConnectOptions): Promise<UnixConn>;
§
connect(options: ConnectOptions): Promise<TcpConn>
[src]

UNSTABLE: The unix socket transport is unstable as a new API yet to be vetted. The TCP transport is considered stable.

Connects to the hostname (default is "127.0.0.1") and port on the named transport (default is "tcp"), and resolves to the connection (Conn).

const conn1 = await Deno.connect({ port: 80 });
const conn2 = await Deno.connect({ hostname: "192.0.2.1", port: 80 });
const conn3 = await Deno.connect({ hostname: "[2001:db8::1]", port: 80 });
const conn4 = await Deno.connect({ hostname: "golang.org", port: 80, transport: "tcp" });
const conn5 = await Deno.connect({ path: "/foo/bar.sock", transport: "unix" });

Requires allow-net permission for "tcp" and allow-read for "unix".

§Parameters

§
options: ConnectOptions
[src]

§Return Type

§
Promise<TcpConn>
[src]
§
connect(options: UnixConnectOptions): Promise<UnixConn>
[src]

§Parameters

§Return Type

§
Promise<UnixConn>
[src]