{"id":28050664,"url":"https://github.com/chainsafe/js-libp2p-yamux","last_synced_at":"2025-08-27T19:33:21.804Z","repository":{"id":39584561,"uuid":"469954819","full_name":"ChainSafe/js-libp2p-yamux","owner":"ChainSafe","description":"Typescript implementation of Yamux","archived":false,"fork":false,"pushed_at":"2025-06-25T13:17:05.000Z","size":841,"stargazers_count":16,"open_issues_count":6,"forks_count":13,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-08-18T13:50:36.640Z","etag":null,"topics":["javascript","libp2p","libp2p-muxer","stream","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ChainSafe.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-03-15T00:51:16.000Z","updated_at":"2025-06-27T04:28:35.000Z","dependencies_parsed_at":"2024-02-07T21:26:02.836Z","dependency_job_id":"7510c60e-a76e-4256-a95d-47efe9f8883e","html_url":"https://github.com/ChainSafe/js-libp2p-yamux","commit_stats":{"total_commits":28,"total_committers":5,"mean_commits":5.6,"dds":0.6785714285714286,"last_synced_commit":"da397130d09fda8c1b11196128985efaacfe6f6b"},"previous_names":[],"tags_count":30,"template":false,"template_full_name":null,"purl":"pkg:github/ChainSafe/js-libp2p-yamux","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChainSafe%2Fjs-libp2p-yamux","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChainSafe%2Fjs-libp2p-yamux/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChainSafe%2Fjs-libp2p-yamux/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChainSafe%2Fjs-libp2p-yamux/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ChainSafe","download_url":"https://codeload.github.com/ChainSafe/js-libp2p-yamux/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChainSafe%2Fjs-libp2p-yamux/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272367881,"owners_count":24922230,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-27T02:00:09.397Z","response_time":76,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["javascript","libp2p","libp2p-muxer","stream","typescript"],"created_at":"2025-05-12T00:38:32.144Z","updated_at":"2025-08-27T19:33:21.774Z","avatar_url":"https://github.com/ChainSafe.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @chainsafe/libp2p-yamux\n\n[![codecov](https://img.shields.io/codecov/c/github/ChainSafe/js-libp2p-yamux.svg?style=flat-square)](https://codecov.io/gh/ChainSafe/js-libp2p-yamux)\n[![CI](https://img.shields.io/github/actions/workflow/status/ChainSafe/js-libp2p-yamux/js-test-and-release.yml?branch=master\\\u0026style=flat-square)](https://github.com/ChainSafe/js-libp2p-yamux/actions/workflows/js-test-and-release.yml?query=branch%3Amaster)\n\n\u003e Yamux stream multiplexer for libp2p\n\n# About\n\n\u003c!--\n\n!IMPORTANT!\n\nEverything in this README between \"# About\" and \"# Install\" is automatically\ngenerated and will be overwritten the next time the doc generator is run.\n\nTo make changes to this section, please update the @packageDocumentation section\nof src/index.js or src/index.ts\n\nTo experiment with formatting, please run \"npm run docs\" from the root of this\nrepo and examine the changes made.\n\n--\u003e\n\nThis module is a JavaScript implementation of [Yamux from Hashicorp](https://github.com/hashicorp/yamux/blob/master/spec.md) designed to be used with [js-libp2p](https://github.com/libp2p/js-libp2p).\n\n## Example - Configure libp2p with Yamux\n\n```typescript\nimport { createLibp2p } from 'libp2p'\nimport { yamux } from '@chainsafe/libp2p-yamux'\n\nconst node = await createLibp2p({\n  // ... other options\n  streamMuxers: [\n    yamux()\n  ]\n})\n```\n\n## Example - Using the low-level API\n\n```js\nimport { yamux } from '@chainsafe/libp2p-yamux'\nimport { pipe } from 'it-pipe'\nimport { duplexPair } from 'it-pair/duplex'\nimport all from 'it-all'\n\n// Connect two yamux muxers to demo basic stream multiplexing functionality\n\nconst clientMuxer = yamux({\n  client: true,\n  onIncomingStream: stream =\u003e {\n    // echo data on incoming streams\n    pipe(stream, stream)\n  },\n  onStreamEnd: stream =\u003e {\n    // do nothing\n  }\n})()\n\nconst serverMuxer = yamux({\n  client: false,\n  onIncomingStream: stream =\u003e {\n    // echo data on incoming streams\n    pipe(stream, stream)\n  },\n  onStreamEnd: stream =\u003e {\n    // do nothing\n  }\n})()\n\n// `p` is our \"connections\", what we use to connect the two sides\n// In a real application, a connection is usually to a remote computer\nconst p = duplexPair()\n\n// connect the muxers together\npipe(p[0], clientMuxer, p[0])\npipe(p[1], serverMuxer, p[1])\n\n// now either side can open streams\nconst stream0 = clientMuxer.newStream()\nconst stream1 = serverMuxer.newStream()\n\n// Send some data to the other side\nconst encoder = new TextEncoder()\nconst data = [encoder.encode('hello'), encoder.encode('world')]\npipe(data, stream0)\n\n// Receive data back\nconst result = await pipe(stream0, all)\n\n// close a stream\nstream1.close()\n\n// close the muxer\nclientMuxer.close()\n```\n\n# Install\n\n```console\n$ npm i @chainsafe/libp2p-yamux\n```\n\n## Browser `\u003cscript\u003e` tag\n\nLoading this module through a script tag will make its exports available as `ChainsafeLibp2pYamux` in the global namespace.\n\n```html\n\u003cscript src=\"https://unpkg.com/@chainsafe/libp2p-yamux/dist/index.min.js\"\u003e\u003c/script\u003e\n```\n\n# API Docs\n\n- \u003chttps://ChainSafe.github.io/js-libp2p-yamux\u003e\n\n# License\n\nLicensed under either of\n\n- Apache 2.0, ([LICENSE-APACHE](https://github.com/ChainSafe/js-libp2p-yamux/LICENSE-APACHE) / \u003chttp://www.apache.org/licenses/LICENSE-2.0\u003e)\n- MIT ([LICENSE-MIT](https://github.com/ChainSafe/js-libp2p-yamux/LICENSE-MIT) / \u003chttp://opensource.org/licenses/MIT\u003e)\n\n# Contribution\n\nUnless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchainsafe%2Fjs-libp2p-yamux","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchainsafe%2Fjs-libp2p-yamux","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchainsafe%2Fjs-libp2p-yamux/lists"}