function readFileAsDataURL(file) {
  return $.Deferred((deferred) => {
    $.extend(new FileReader(), {
      onload: (event) => {
        const dataURL = event.target.result;
        deferred.resolve(dataURL);
      },
      onerror: (err) => {
        deferred.reject(err);
      },
    }).readAsDataURL(file);
  }).promise();
}
@method readFileAsDataURL

read contents of file as representing URL

@param {File} file
@return {Promise} - then: dataUrl