MCPcopy
hub / github.com/entropic-dev/entropic / addBuffer

Method addBuffer

services/storage/lib/object-storage.js:30–47  ·  view source on GitHub ↗
(integrity, data, { hint = null } = {})

Source from the content-addressed store, hash-verified

28 }
29
30 async addBuffer(integrity, data, { hint = null } = {}) {
31 const targets = [];
32 for (const algo of this.algorithms) {
33 for (const { digest } of integrity[algo] || []) {
34 targets.push(
35 this.strategy.has(algo, digest).then(has => {
36 if (!has) {
37 return this.strategy.add(algo, digest, data);
38 }
39 })
40 );
41 }
42 }
43
44 await Promise.all(targets);
45
46 return integrity.toString('base64');
47 }
48
49 // XXX: do we even need this? we know which algo folks are asking for.
50 async get(integrity) {

Callers 3

addMethod · 0.95
cloneFunction · 0.80
versionCreateFunction · 0.80

Calls 2

hasMethod · 0.80
addMethod · 0.45

Tested by

no test coverage detected