MCPcopy
hub / github.com/apache/pouchdb / fetchAttachments

Function fetchAttachments

lib/index.js:5004–5022  ·  view source on GitHub ↗
(results, stores, opts)

Source from the content-addressed store, hash-verified

5002}
5003
5004function fetchAttachments(results, stores, opts) {
5005 var atts = [];
5006 results.forEach(function (row) {
5007 if (!(row.doc && row.doc._attachments)) {
5008 return;
5009 }
5010 var attNames = Object.keys(row.doc._attachments);
5011 attNames.forEach(function (attName) {
5012 var att = row.doc._attachments[attName];
5013 if (!('data' in att)) {
5014 atts.push(att);
5015 }
5016 });
5017 });
5018
5019 return Promise.all(atts.map(function (att) {
5020 return fetchAttachment(att, stores, opts);
5021 }));
5022}
5023
5024function LevelPouch(opts, callback) {
5025 opts = clone(opts);

Callers 4

LevelPouchFunction · 0.70
completeFunction · 0.70
onGetWinningDocFunction · 0.70
fetchAllAttachmentsFunction · 0.70

Calls 3

fetchAttachmentFunction · 0.70
fetchDataFunction · 0.70
poolFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…