code: function postProcessAttachments(results, asBlob) {
    return Promise.all(results.map(function (row) {
      if (row.doc && row.doc._attachments) {
        var attNames = Object.keys(row.doc._attachments);
        return Promise.all(attNames.map(function (att) {
          var attObj = row.doc._attachments[att];
          if (!('body' in attObj)) { // already processed
            return;
          }
          var body = attObj.body;
          var type = attObj.content_type;
          return new Promise(function (resolve) {
            readBlobData(body, type, asBlob, function (data) {
              row.doc._attachments[att] = pouchdbUtils.assign(
                pouchdbUtils.pick(attObj, ['digest', 'content_type']),
                {data: data}
              );
              resolve();
            });
          });
        }));
      }
    }));
  }
docs: IDB-specific postprocessing necessary because we don't know whether we stored a true Blob or a base64-encoded string, and if it's a Blob it needs to be read outside of the transaction context