Skip to content

Use a sticky 🍯 & memorable name to seed 🌱 a p2p swarm 🐝 and generate feeds, managed by multifeed for the web πŸ•ΈοΈ.

Notifications You must be signed in to change notification settings

prm3theus/swarm-feeder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

11 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🐝 swarm-feeder 🍯 (in progress)

Use a sticky & memorable name to seed a p2p swarm and generate feeds, managed by multifeed for the web πŸ•ΈοΈ.

Really just an opinionated & useful combination of abstractions from a few ~floating hypercore based modules (e.g. hypercore, hyperswarm, multifeed, crypto, etc.) for any p2p farmer, punk, or api(ar)ists.

How to Use

install: yarn add swarm-feeder

// duh
const SwarmFeeder = require('swarm-feeder')

// if for the web, pass in `wsProxy`
const feeder = SwarmFeeder({encoding: 'utf-8'}) 

// seed or join a name for the swarm, outputs hash (can join from hash too)
await feeder.swarm("bumble-colony")
// => 'bee80ff3a4ee5e727dc44197cb9d25bf8f19d50b0f3ad2984cfe5b7d14e75de7'
// => 2 peers connected, things are happenin'

// push to the default local feed, replicates to all remote
await feeder.local.push("bzz")

// keep a watch out for items that are added
await feeder.watch()
// => watching for anything new ... 
// => got one! { 'bzz' }

// pull from remote feed, based on id or name
await feeder.remote.pull(0, console.log)
// => { 0: ['howdy', 'ho'] }

If a name is not given, seed 🌱 the location for the swarm by a random tree name for others to join, courtesy of per.

await feeder.seed()
// => 'flowering-almira-norway-maple'
// => 'b2b26976c9ae329e2b8ce072d28hhell05d9e20a7f24a6af917f0ed3ad3f8b5a5'
// => 0 peers connected, :(

TODO

  • minimal impl
  • naming for feeds (deal with collision)

License

MIT

About

Use a sticky 🍯 & memorable name to seed 🌱 a p2p swarm 🐝 and generate feeds, managed by multifeed for the web πŸ•ΈοΈ.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published