MCPcopy Index your code
hub / github.com/apache/pouchdb / fetchData

Function fetchData

lib/index.es.js:7154–7185  ·  view source on GitHub ↗
(filename)

Source from the content-addressed store, hash-verified

7152 // which we cannot parse. Also, this is more efficient than
7153 // receiving attachments as base64-encoded strings.
7154 async function fetchData(filename) {
7155 const att = atts[filename];
7156 const path$$1 = encodeDocId(doc._id) + '/' + encodeAttachmentId(filename) +
7157 '?rev=' + doc._rev;
7158
7159 const response = await ourFetch(genDBUrl(host, path$$1));
7160
7161 let blob;
7162 if ('buffer' in response) {
7163 blob = await response.buffer();
7164 } else {
7165 /* istanbul ignore next */
7166 blob = await response.blob();
7167 }
7168
7169 let data;
7170 if (opts.binary) {
7171 const typeFieldDescriptor = Object.getOwnPropertyDescriptor(blob.__proto__, 'type');
7172 if (!typeFieldDescriptor || typeFieldDescriptor.set) {
7173 blob.type = att.content_type;
7174 }
7175 data = blob;
7176 } else {
7177 data = await new Promise(function (resolve) {
7178 blobToBase64(blob, resolve);
7179 });
7180 }
7181
7182 delete att.stub;
7183 delete att.length;
7184 att.data = data;
7185 }
7186
7187 const promiseFactories = filenames.map(function (filename) {
7188 return function () {

Callers 3

fetchAttachmentsFunction · 0.70
fetchedFunction · 0.70
HttpPouchFunction · 0.70

Calls 8

encodeDocIdFunction · 0.70
encodeAttachmentIdFunction · 0.70
ourFetchFunction · 0.70
genDBUrlFunction · 0.70
blobToBase64Function · 0.70
paramsToStrFunction · 0.70
setupFunction · 0.70
fetchJSONFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…