Home > Engineering > Infrastructure > P2P building blocks > Hyperdrive

Hyperdrive

Hyperdrive is a secure, realtime, distributed filesystem. It is a three-layer composition: a Hyperbee holds the metadata (paths → entry records), a Hyperblobs holds the file content, and both are backed by one Corestore. Because metadata and content are separate cores, listing and content sync independently — which is what makes selective sync and versioned diffs cheap.


Core API

See the README for exhaustive detail.

Create

const drive = new Hyperdrive(store, [key])

store must be a Corestore; key loads an existing drive.

Files

Listing

Streams & batches

Sync

Accessors


Gotchas

Metadata and content are separate cores. “I have the listing but not the bytes” is a normal, expected (sparse) state — and update() / download() behave differently for metadata vs content. Don’t assume an entry means its content is local.

get() returns null for symlinks too, not just missing files — resolve via entry()’s value.linkname; don’t treat null as “absent.”

findingPeers() is the classic footgun. Call the function it returns once peer discovery has finished — skip it and update() can resolve against zero peers and report a stale version.


Version

hyperdrive@13 (current latest is the 13.x line). The storage migration reaches Hyperdrive through its Corestore; transitional next/tmp dist-tags exist, so use latest and check the npm registry before pinning.

Sources