# ready-resource

> Modern single resource management

Latest version **1.2.0** (published 2025-08-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install ready-resource
pnpm add ready-resource
yarn add ready-resource
bun add ready-resource
```

## Health

**Score 45/100 (D)** — status: stable.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: stale.

## Facts

| | |
|---|---|
| Version | 1.2.0 |
| Published | 2025-08-20 |
| First published | 2022-09-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 5.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 21 |
| Author | Mathias Buus |
| Maintainers | mafintosh |

## Links

- npm: https://www.npmjs.com/package/ready-resource
- Repository: https://github.com/holepunchto/ready-resource
- Issues: https://github.com/holepunchto/ready-resource/issues
- npm.io page: https://npm.io/package/ready-resource

## Dependencies (1)

- [bare-events](https://npm.io/package/bare-events.md) ^2.2.0

## Recent versions

- 1.2.0 (latest) — 2025-08-20
- 1.1.2 — 2025-02-13
- 1.1.1 — 2024-06-14
- 1.1.0 — 2024-06-14
- 1.0.3 — 2024-02-07
- 1.0.2 — 2024-02-07
- 1.0.1 — 2024-02-07
- 1.0.0 — 2022-09-12
- 0.0.0 — 2022-09-12

## README

# ready-resource

Modern single resource management

```
npm install ready-resource
```

## Usage

``` js
const ReadyResource = require('ready-resource')

class Thing extends ReadyResource {
  constructor () {
    super()
  }

  async _open () {
    // open the resource
  }

  async _close () {
    // close the resource
  }
}

const r = new Thing()

await r.ready() // calls _open once
await r.ready() // noop

await r.close() // calls _close after _open has finished
await r.close() // noop
```

## License

MIT

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