The storage engine for Hypercore, built on RocksDB. This package provides low-level I/O for Hypercore, including creating and resuming cores, reading/writing blocks, tree nodes, bitfield pages, and user-defined data, as well as atomic batch operations and streams for core listing and data traversal. Current stable version is 3.1.1. It is designed for use with Hypercore 11 and provides a more flexible and efficient storage layer compared to older versions. Release cadence is irregular, tied to Hypercore updates.
npm install hypercore-storageNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Creates a hypercore storage instance, writes a block, reads it back, and closes the store.
Always call rx.tryFlush() after your read operations, or use an alternative pattern that flushes automatically.
Use import syntax or switch to dynamic import. For Node.js <14, consider using a transpiler or downgrading to v2.
Check the return value before using it: const core = await store.resumeCore(dk); if (!core) throw new Error('Core not found');Always await tx.flush() and handle errors. Do not assume the write succeeded until flush completes.
Change to import Storage from 'hypercore-storage' (ESM) or use dynamic import: const { default: Storage } = await import('hypercore-storage')Create a new read batch for every set of read operations: const rx = core.read(); const block = await rx.getBlock(0); rx.tryFlush();
Ensure the core exists: const core = await store.resumeCore(dk); if (core) { const tx = core.write(); ... }