A library for creating and managing feeds using Hyperdrive and Hyperswarm.
Initiate the library.
const feeds = new Feeds();
const feedID = feeds.randomID();
await feeds.update(feedID, 'balance', 1000);
Create a Feeds instance.
storage
Storage directory to save feeds at. Defaults to os.homedir() + '/.slashtags-feeds/'
opts
includes:
metadata
: an object of metadata files to be saved along the data. example{ schema: schema }
Generate a random string id to be used as the feedID.
Returns the feed key
and encryptionKey
for a given feed, identified by any serializable id.
It awaits until the feed is announced on the swarm.
Updates a feed. key
is a string, and value
is Uint8Array or a utf-8 string.
Returns a Uint8Array value from a feed.
Gracefully closing feeds and freeing IO resources.
Destroys all stored data for the feed.
As of this first version, Slashtags feeds is a directory on top of Hyperdrive with the current structure:
├── feed
│ ├── foo
│ ├── bar
└── slashfeed.json
Where slashfeed.json
defines the name
, image
and other future metadata about the feed.
And feed
directory contains the feed files, where each file represents a key value pair.