Files: 34d957aac81ecdd3f4531d9e49c2d663178b0b32 / tmpl / apis / scuttlebot / blobs.md
1449 bytesRaw
scuttlebot blobs plugin
Send/receive files by content-hashes.
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))
- 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.
rm hash
rm(hash, cb)
- hash (base64 string): hash of the file.
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.
Built with git-ssb-web