Waits for a hypercore to be _really_ ready. That is, that it's synced with peers and is good to go
MIT License
Waits for a hypercore to be really ready. That is, that it's synced with peers and is good to go
Checks for the following:
ready
event to make sure internal stuff is initializedYou should probably wrap this with a timeout for any user-facing application since there's a chance a feed will never get peers.
npm install --save hypercore-really-ready
const reallyReady = require('hypercore-really-ready')
// The feed is initialized and has synced with peers
// You might want to wrap this in a timeout
await reallyReady(feed)
// If you have a hyperdrive, pass in its metadata feed
// This will make sure you don't get empty or outdated readdir calls
await reallyReady(hyperdrive.metadata)
// You can also use callbacks if that's more your thing
reallyReady(feed, (err) => {
if(err) console.error(err)
else console.log('It's ready!')
})