@blockits/object-multiplex
v1.2.0
Published
Simple stream multiplexing for objectMode.
Downloads
1
Readme
@metamask/object-multiplex
Simple stream multiplexing for objectMode
.
Usage
// 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 version 12
- If you are using nvm (recommended) running
nvm use
will automatically choose the right node version for you.
- If you are using nvm (recommended) running
- Install Yarn v1
- Run
yarn setup
to install dependencies and run any requried post-install scripts- Warning: Do not use the
yarn
/yarn install
command directly. Useyarn setup
instead. The normal install command will skip required post-install scripts, leaving your development environment in an invalid state.
- Warning: Do not use the
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:
- 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
)
- For a typical release, this would be based on
- Update the changelog
- Update version in package.json file (e.g.
yarn version --minor --no-git-tag-version
) - Create a pull request targeting the base branch (e.g. master or 1.x)
- Code review and QA
- Once approved, the PR is squashed & merged
- The commit on the base branch is tagged
- The tag can be published as needed