Skip to content

Hyperdrive

Defined in: node_modules/.pnpm/@cloudflare+workers-types@4.20251118.0/node_modules/@cloudflare/workers-types/index.ts:8762

readonly connectionString: string

Defined in: node_modules/.pnpm/@cloudflare+workers-types@4.20251118.0/node_modules/@cloudflare/workers-types/index.ts:8780

A valid DB connection string that can be passed straight into the typical client library/driver/ORM. This will typically be the easiest way to use Hyperdrive.


readonly database: string

Defined in: node_modules/.pnpm/@cloudflare+workers-types@4.20251118.0/node_modules/@cloudflare/workers-types/index.ts:8807


readonly host: string

Defined in: node_modules/.pnpm/@cloudflare+workers-types@4.20251118.0/node_modules/@cloudflare/workers-types/index.ts:8787


readonly password: string

Defined in: node_modules/.pnpm/@cloudflare+workers-types@4.20251118.0/node_modules/@cloudflare/workers-types/index.ts:8803


readonly port: number

Defined in: node_modules/.pnpm/@cloudflare+workers-types@4.20251118.0/node_modules/@cloudflare/workers-types/index.ts:8791


readonly user: string

Defined in: node_modules/.pnpm/@cloudflare+workers-types@4.20251118.0/node_modules/@cloudflare/workers-types/index.ts:8796

connect(): Socket

Defined in: node_modules/.pnpm/@cloudflare+workers-types@4.20251118.0/node_modules/@cloudflare/workers-types/index.ts:8774

Connect directly to Hyperdrive as if it’s your database, returning a TCP socket.

Calling this method returns an idential socket to if you call connect("host:port") using the host and port fields from this object. Pick whichever approach works better with your preferred DB client library.

Note that this socket is not yet authenticated — it’s expected that your code (or preferably, the client library of your choice) will authenticate using the information in this class’s readonly fields.

Socket