(results, asBlob)
| 4829 | // a base64-encoded string, and if it's a Blob it |
| 4830 | // needs to be read outside of the transaction context |
| 4831 | function postProcessAttachments(results, asBlob) { |
| 4832 | return Promise.all(results.map(function (row) { |
| 4833 | if (row.doc && row.doc._attachments) { |
| 4834 | var attNames = Object.keys(row.doc._attachments); |
| 4835 | return Promise.all(attNames.map(function (att) { |
| 4836 | var attObj = row.doc._attachments[att]; |
| 4837 | if (!('body' in attObj)) { // already processed |
| 4838 | return; |
| 4839 | } |
| 4840 | var body = attObj.body; |
| 4841 | var type = attObj.content_type; |
| 4842 | return new Promise(function (resolve) { |
| 4843 | readBlobData(body, type, asBlob, function (data) { |
| 4844 | row.doc._attachments[att] = Object.assign( |
| 4845 | pick(attObj, ['digest', 'content_type']), |
| 4846 | {data} |
| 4847 | ); |
| 4848 | resolve(); |
| 4849 | }); |
| 4850 | }); |
| 4851 | })); |
| 4852 | } |
| 4853 | })); |
| 4854 | } |
| 4855 | |
| 4856 | function compactRevs(revs, docId, txn) { |
| 4857 |
no test coverage detected
searching dependent graphs…