{"id":15467956,"url":"https://github.com/rangermauve/hyper-flood","last_synced_at":"2025-07-11T03:33:45.357Z","repository":{"id":40612950,"uuid":"269732201","full_name":"RangerMauve/hyper-flood","owner":"RangerMauve","description":"Flooding broadcast using hypercore-protocol extensions","archived":false,"fork":false,"pushed_at":"2022-10-08T05:29:18.000Z","size":49,"stargazers_count":14,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-07-08T05:19:17.161Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RangerMauve.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-06-05T18:11:28.000Z","updated_at":"2023-07-04T04:43:51.000Z","dependencies_parsed_at":"2023-01-19T15:46:00.995Z","dependency_job_id":null,"html_url":"https://github.com/RangerMauve/hyper-flood","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/RangerMauve/hyper-flood","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RangerMauve%2Fhyper-flood","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RangerMauve%2Fhyper-flood/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RangerMauve%2Fhyper-flood/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RangerMauve%2Fhyper-flood/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RangerMauve","download_url":"https://codeload.github.com/RangerMauve/hyper-flood/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RangerMauve%2Fhyper-flood/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264721599,"owners_count":23653964,"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","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":[],"created_at":"2024-10-02T01:33:50.599Z","updated_at":"2025-07-11T03:33:45.337Z","avatar_url":"https://github.com/RangerMauve.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# hyper-flood\nFlooding broadcast using hypercore-protocol extensions\n\n```\nnpm i --save hyper-flood\n```\n\n```js\nconst HyperFlood = require('hyper-flood')\n\nconst feed = hypercore()\n\nconst flood = new HyperFlood()\n\nfeed.registerExtension('example', flood.extension())\n\nflood.on('message', (message) =\u003e console.log(message.toString('utf8')))\n\nfeed.on('peer-open', () =\u003e {\n\tflood.broadcast(Buffer.from('Hello World!'))\n})\n```\n\n## How it works\n\nThis uses hypercore-protocol extension messages to broadcast messages throughout a network using [flooding](https://en.wikipedia.org/wiki/Flooding_(computer_networking)).\nEach message gets tagged with a unique ID and peers will pass on any messages they see, and ignore messages they've already seen.\nThere's also a TTL (defaults to 255) if you want to limit how far it travlls.\nInterally, there's an LRU that remembers the l\n\n## API\n\n### `const flood = new HyperFlood({id, lruSize, ttl, messageNumber})`\n\nCreates a new instance of a flood. All configs are optional\n\n- `id` is a `Buffer` with some sort of unique identifier. This gets randomly generated if not provided.\n- `lruSize` is how many message IDs should be remembered at a time to avoid duplicates. Defaults to `255`\n- `ttl` is the number of hops a message can travel before it'll get ignored, defaults to `255`\n- `messageNumber` is the message index to start with. Defaults to `0`. Not sure why you'd set this.\n\n### `flood.on('message', (message, originId, messageNumber) =\u003e whatever)`\n\nYou can listen on messages that show up through the flood with this event.\n\n- `message` is a `Buffer` for the message that got sent.\n- `originId` is the `id` of the peer this message originated from (no guarantee it's them)\n- `messageNumber` is the message index for this message from this peer.\n\n### `flood.on('error', (err) =\u003e whatever)`\n\nThis gets emitted when there's an error, usually while parsing the message data.\n\n### `flood.broadcast(message, ttl)`\n\nUse this to broadcast out messages into the network.\n\n- `message` should be a `Buffer` to send out to the swarm.\n- `ttl` is optional and will use the TTL specified in the constructor by default. This specifies the number of hops a message will be re-broascasted between peers. Set this to `0` to only reach peers you're directly connected to.\n\n### `const extensionHandlers = flood.extension()`\n\nThis will create extension handlers for use in hypercore-protocol.\n\n- `extensionHandlers` should be passed to `protocol.registerExtension` or `feed.registerExtension`.\n\n---\n\n## Credits\n\nCe logiciel a été créé dans le cadre du projet de plateforme virtuelle de création autochtone P2P Natakanu. Une réalisation de Wapikoni Mobile, Uhu Labos Nomades et du Bureau de l'engagement communautaire de l'université Concordia. Projet financé dans le cadre de l'Entente sur le développement culturel de Montréal conclue entre la Ville de Montréal et gouvernement du Québec.\n\n---\n\nThis software was created as part of Natakanu, a P2P indigenous  platform produced by Wapikoni Mobile, Uhu Labos Nomades and the Office of Community Engagement at Concordia University. Project funded under the Montreal cultural development agreement between the city of Montreal and the government of Quebec.\n\n\u003cimg src=\"quebec.png\" width=\"395\" alt=\"Quebec Province Logo\" /\u003e\n\u003cimg src=\"montreal.jpg\" width=\"395\" alt=\"Montreal City Logo\" /\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frangermauve%2Fhyper-flood","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frangermauve%2Fhyper-flood","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frangermauve%2Fhyper-flood/lists"}