# hypercore-really-ready

> Waits for a hypercore to be _really_ ready. That is, that it's synced with peers and is good to go

Latest version **1.0.0** (published 2020-03-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install hypercore-really-ready
pnpm add hypercore-really-ready
yarn add hypercore-really-ready
bun add hypercore-really-ready
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2020-03-25 |
| First published | 2020-03-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 4.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | rangermauve |
| Maintainers | rangermauve |
| Keywords | hypercore, ready, dat |

## Links

- npm: https://www.npmjs.com/package/hypercore-really-ready
- Repository: https://github.com/RangerMauve/hypercore-really-ready
- Homepage: https://github.com/RangerMauve/hypercore-really-ready#readme
- Issues: https://github.com/RangerMauve/hypercore-really-ready/issues
- npm.io page: https://npm.io/package/hypercore-really-ready

## Recent versions

- 1.0.0 (latest) — 2020-03-25

## README

# hypercore-really-ready
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:

- Waits for the `ready` event to make sure internal stuff is initialized
- If the feed is writable, it's ready
- If you have peers, make sure you know what the latest index they know if is
- If you don't have peers, wait for them and update the index

You should probably wrap this with a timeout for any user-facing application since there's a chance a feed will never get peers.

## Installing

```
npm install --save hypercore-really-ready
```

## Example

```javascript
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!')
})
```

---
_Source: https://npm.io/package/hypercore-really-ready · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
