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

Function readBlobData

lib/index-browser.js:4772–4792  ·  view source on GitHub ↗
(body, type, asBlob, callback)

Source from the content-addressed store, hash-verified

4770// and translating from base64 if the IDB doesn't support
4771// native Blobs
4772function readBlobData(body, type, asBlob, callback) {
4773 if (asBlob) {
4774 if (!body) {
4775 callback(createBlob([''], {type}));
4776 } else if (typeof body !== 'string') { // we have blob support
4777 callback(body);
4778 } else { // no blob support
4779 callback(b64ToBluffer(body, type));
4780 }
4781 } else { // as base64 string
4782 if (!body) {
4783 callback('');
4784 } else if (typeof body !== 'string') { // we have blob support
4785 readAsBinaryString(body, function (binary) {
4786 callback(thisBtoa(binary));
4787 });
4788 } else { // no blob support
4789 callback(body);
4790 }
4791 }
4792}
4793
4794function fetchAttachmentsIfNecessary(doc, opts, txn, cb) {
4795 var attachments = Object.keys(doc._attachments || {});

Callers 2

postProcessAttachmentsFunction · 0.70
initFunction · 0.70

Calls 4

createBlobFunction · 0.70
b64ToBlufferFunction · 0.70
readAsBinaryStringFunction · 0.70
thisBtoaFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…