holepunchto / hyperdrive

Hyperdrive is a secure, real time distributed file system
Apache License 2.0
1.86k stars 135 forks source link

Add aliases for core properties #338

Closed LuKks closed 1 year ago

LuKks commented 1 year ago

In combination with https://github.com/holepunchto/hyperbee/pull/119

It potentially allows a simpler API for replication like this:

const swarm = new Hyperswarm()
swarm.on('connection', (socket) => drive.replicate(socket))
swarm.join(drive) // Or a bee

It would always pass down { discoveryKey, findingPeers } for all building blocks like Hypercore, Hyperbee, and Hyperdrive. User should still manually call the replicate method to avoid any magic, but looks very safe to automatically handle the discovery key to find peers.

mafintosh commented 1 year ago

11.1.0