scuttlebot blobs plugin
Send/receive files by content-hashes.
get: source
Get a blob by its ID.
bash
js
get {blobid}
get(blobid)
has: async
Check if the blob of the given ID is stored in the DB.
bash
js
has {blobid}
has(blobid, cb)
add: sink
Add a new blob to the DB.
bash
js
cat ./file | add [hash]
pull(source, add(hash, cb))
- hash (base64 string): Optional, expected hash of the file. If the file does not match the hash, it is not stored, and an error is emitted.
rm: async
Remove a blob from the store.
bash
js
rm hash
rm(hash, cb)
- hash (base64 string): hash of the file.
ls: source
List the hashes of the blobs in the DB.
bash
js
ls
ls()
want: async
Begin searching the network for the blob of the given hash.
bash
js
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.
bash
js
wants
wants()
changes: source
Listen for any newly-downloaded blobs.
bash
js
changes
changes()
When a blob is downloaded, this stream will emit the hash of the blob.