Hyperdrive
Defined in: node_modules/.pnpm/@cloudflare+workers-types@4.20250923.0/node_modules/@cloudflare/workers-types/index.ts:8158
Properties
Section titled “Properties”connectionString
Section titled “connectionString”
readonlyconnectionString:string
Defined in: node_modules/.pnpm/@cloudflare+workers-types@4.20250923.0/node_modules/@cloudflare/workers-types/index.ts:8176
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.
database
Section titled “database”
readonlydatabase:string
Defined in: node_modules/.pnpm/@cloudflare+workers-types@4.20250923.0/node_modules/@cloudflare/workers-types/index.ts:8203
readonlyhost:string
Defined in: node_modules/.pnpm/@cloudflare+workers-types@4.20250923.0/node_modules/@cloudflare/workers-types/index.ts:8183
password
Section titled “password”
readonlypassword:string
Defined in: node_modules/.pnpm/@cloudflare+workers-types@4.20250923.0/node_modules/@cloudflare/workers-types/index.ts:8199
readonlyport:number
Defined in: node_modules/.pnpm/@cloudflare+workers-types@4.20250923.0/node_modules/@cloudflare/workers-types/index.ts:8187
readonlyuser:string
Defined in: node_modules/.pnpm/@cloudflare+workers-types@4.20250923.0/node_modules/@cloudflare/workers-types/index.ts:8192
Methods
Section titled “Methods”connect()
Section titled “connect()”connect():
Socket
Defined in: node_modules/.pnpm/@cloudflare+workers-types@4.20250923.0/node_modules/@cloudflare/workers-types/index.ts:8170
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.