# @metamask/object-multiplex

> Simple stream multiplexing for objectMode.

Latest version **2.1.0** (published 2024-10-14) · ISC license · 0 weekly downloads

## Install

```sh
npm install @metamask/object-multiplex
pnpm add @metamask/object-multiplex
yarn add @metamask/object-multiplex
bun add @metamask/object-multiplex
```

## Health

**Score 35/100 (D)** — status: maintenance-mode.

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

Warnings: low downloads; no esm support.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.1.0 |
| Published | 2024-10-14 |
| First published | 2020-12-08 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | ^16.20 \|\| ^18.16 \|\| >=20 |
| Dependencies | 2 |
| Unpacked size | 13.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 15 |
| Maintainers | mcmire, nicholasellul, lgbot, naugtur, ritave, danfinlay, kumavis, rekmarks, metamaskbot, gudahtt, sethkfman |

## Links

- npm: https://www.npmjs.com/package/@metamask/object-multiplex
- Repository: https://github.com/MetaMask/object-multiplex
- Homepage: https://github.com/MetaMask/object-multiplex#readme
- Issues: https://github.com/MetaMask/object-multiplex/issues
- npm.io page: https://npm.io/package/@metamask/object-multiplex

## Dependencies (2)

- [once](https://npm.io/package/once.md) ^1.4.0
- [readable-stream](https://npm.io/package/readable-stream.md) ^3.6.2

## Recent versions

- 2.1.0 (latest) — 2024-10-14
- 2.0.0 — 2023-10-25
- 1.3.0 — 2023-10-24
- 1.2.0 — 2021-06-01
- 1.1.0 — 2020-12-08

## README

# @metamask/object-multiplex

Simple stream multiplexing for `objectMode`.

## Usage

```js
// create multiplexer
const mux = new ObjMultiplex();

// setup substreams
const streamA = mux.createStream("hello");
const streamB = mux.createStream("world");

// pipe over transport (and back)
mux.pipe(transport).pipe(mux);

// send values over the substreams
streamA.write({ thisIsAn: "object" });
streamA.write(123);

// or pipe together normally
streamB.pipe(evilAiBrain).pipe(streamB);
```

## Contributing

### Setup

- Install [Node.js](https://nodejs.org) version 18
  - If you are using [nvm](https://github.com/creationix/nvm#installation) (recommended) running `nvm use` will automatically choose the right node version for you.
- Install [Yarn v1](https://yarnpkg.com/en/docs/install)
- Run `yarn setup` to install dependencies and run any requried post-install scripts
  - **Warning:** Do not use the `yarn` / `yarn install` command directly. Use `yarn setup` instead. The normal install command will skip required post-install scripts, leaving your development environment in an invalid state.

### Testing and Linting

Run `yarn test` to run the tests once.

Run `yarn lint` to run the linter, or run `yarn lint:fix` to run the linter and fix any automatically fixable issues.

### Release & Publishing

The project follows the same release process as the other libraries in the MetaMask organization:

1. Create a release branch
   - For a typical release, this would be based on `main`
   - To update an older maintained major version, base the release branch on the major version branch (e.g. `1.x`)
2. Update the changelog
3. Update version in package.json file (e.g. `yarn version --minor --no-git-tag-version`)
4. Create a pull request targeting the base branch (e.g. master or 1.x)
5. Code review and QA
6. Once approved, the PR is squashed & merged
7. The commit on the base branch is tagged
8. The tag can be published as needed

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