MCPcopy Create free account
hub / github.com/cryptii/cryptii / getContent

Method getContent

src/Pipe.js:474–484  ·  view source on GitHub ↗

* Returns content of given bucket. * @param {number} [bucket=0] Bucket index * @param {boolean} [waitForCompletion=true] If set to true, the value is * being resolved after all pipe tasks have been completed. * @throws {Error} If bucket index is out of bounds. * @return {Chain|Promise

(bucket = 0, waitForCompletion = true)

Source from the content-addressed store, hash-verified

472 * @return {Chain|Promise} content
473 */
474 getContent (bucket = 0, waitForCompletion = true) {
475 if (bucket >= this._bucketContent.length) {
476 throw new Error(`Bucket index ${bucket} is out of bounds.`)
477 }
478 if (waitForCompletion && this.isBusy()) {
479 return new Promise((resolve, reject) => {
480 this._bucketListeners[bucket].push({ resolve, reject })
481 })
482 }
483 return this._bucketContent[bucket]
484 }
485
486 /**
487 * Sets content of given bucket and propagates it through the pipe.

Callers 6

setContentMethod · 0.95
_triggerViewerViewMethod · 0.95
encoderDidReverseMethod · 0.95
brickDidFinishMethod · 0.95
Pipe.jsFile · 0.80

Calls 1

isBusyMethod · 0.95

Tested by

no test coverage detected