code: function insertMultipart (doc, attachments, qs, callback) {
        if (typeof qs === 'string') {
          qs = { docName: qs }
        }
        qs = qs || {}
  
        const docName = qs.docName
        delete qs.docName
  
        doc = Object.assign({ _attachments: {} }, doc)
  
        const multipart = []
  
        attachments.forEach(function (att) {
          doc._attachments[att.name] = {
            follows: true,
            length: Buffer.isBuffer(att.data)
              ? att.data.length : Buffer.byteLength(att.data),
            /* jscs:disable requireCamelCaseOrUpperCaseIdentifiers */
            'content_type': att.content_type
          }
          multipart.push({ body: att.data })
        })
  
        multipart.unshift({
          'content-type': 'application/json',
          body: JSON.stringify(doc)
        })
  
        return relax({
          db: dbName,
          method: 'PUT',
          contentType: 'multipart/related',
          doc: docName,
          qs: qs,
          multipart: multipart
        }, callback)
      }
docs: http://docs.couchdb.org/en/latest/api/document/common.html#creating-multiple-attachments