code: function toBase64 (media) {
    return new Promise((resolve, reject) => {
      if (isBase64(media)) {
        resolve(media)
      } else if (isURL(media)) {
        urlToBase64(media)
        .then(data => resolve(data))
        .catch(error => reject(error))
      } else if (isFile(media)) {
        fileToBase64(media)
        .then(data => resolve(data))
        .catch(error => reject(error))
      } else if (isBuffer(media)) {
        const base64 = media.toString('base64')
        resolve(base64)
      } else {
        reject('Error: toBase64(): cannot convert media')
      }
    })
  }
docs: Reads an image from file or url and convert it to base64
  @param {string} media - url or path
  @returns {Promise}