Home
SSBC
Patchwork
Social Messaging App
Scuttlebot
P2P Log Store
Documentation
APIs, Articles
Key Concepts
API Documentation
Articles

scuttlebot blobs plugin

Send/receive files by content-hashes.

How it works:


better design:

each task has it's own queue. first is queue for has then is queue for download.

once you know where a file is, move it to the download queue. if there arn't any peers to get a file from, put it back in has queue.

get: source

Get a blob by its ID.

get {blobid}
get(blobid)

has: async

Check if the blob of the given ID is stored in the DB.

has {blobid}
has(blobid, cb)

add: sink

Add a new blob to the DB.

cat ./file | add [hash]
pull(source, add(hash, cb))

rm: async

Remove a blob from the store.

rm hash
rm(hash, cb)

ls: source

List the hashes of the blobs in the DB.

ls
ls()

want: async

Begin searching the network for the blob of the given hash.

want {hash} [--nowait]
want(hash, { nowait: }, cb)

By default, want will not call the cb until the blob has been downloaded. If you want the cb to be called immediately, specify nowait: true. The cb will be called with true/false as the value, telling you if the blob was already present.

wants: sync

List the currently-wanted blobs' data-structures.

wants
wants()

changes: source

Listen for any newly-downloaded blobs.

changes
changes()

When a blob is downloaded, this stream will emit the hash of the blob.