# read-write-mutexify

> Like mutexify but with read/write locks

Latest version **2.1.0** (published 2023-06-04) · MIT license · 0 weekly downloads

## Install

```sh
npm install read-write-mutexify
pnpm add read-write-mutexify
yarn add read-write-mutexify
bun add read-write-mutexify
```

## 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 | 2.1.0 |
| Published | 2023-06-04 |
| First published | 2023-06-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 6.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 10 |
| Author | Mathias Buus |
| Maintainers | mafintosh |

## Links

- npm: https://www.npmjs.com/package/read-write-mutexify
- Repository: https://github.com/mafintosh/read-write-mutexify
- Issues: https://github.com/mafintosh/read-write-mutexify/issues
- npm.io page: https://npm.io/package/read-write-mutexify

## Recent versions

- 2.1.0 (latest) — 2023-06-04
- 2.0.0 — 2023-06-02
- 1.0.0 — 2023-06-02

## README

# read-write-mutexify

Like [mutexify](https://github.com/mafintosh/mutexify) but with read/write locks

```
npm install read-write-mutexify
```

## Usage

```js
const RW = require('read-write-mutexify')

const rw = new RW()

// read locks waits for writer locks to be released
await rw.read.lock()
await rw.read.lock() // make as many as you want

// unlock with unlock
rw.read.unlock()
rw.read.unlock()

// only one writer can have the write lock and it waits
// for any read lock to be released

await rw.write.lock()

// unlock with unlock
rw.write.unlock()
```

## License

MIT

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