function convertBase64UrlToBlob(urlData) {
  var arr = dataurl.split(','),//去掉url的头,并转换为byte
  type = arr[0].match(/:(.*?);/)[1],
  fileExt = mime.split('/')[1],
  bstr = atob(arr[1]),
  n = bstr.length,
  u8arr = new Uint8Array(n);
  while(n--) {
    u8arr[n] = bstr.charCodeAt(n);
  }
  return new Blob([ab], { type: type}); 
}
  function convertBase64UrlToFile(urlData) {
	var arr = dataurl.split(','),
	type= arr[0].match(/:(.*?);/)[1],
	fileExt = mime.split('/')[1],
	bstr = atob(arr[1]),
	n = bstr.length,
	u8arr = new Uint8Array(n);
	while(n--) {
		u8arr[n] = bstr.charCodeAt(n);
	}
	return new File([u8arr],"fileName."+fileExt,{type:type});
  }

  

相关文章:

  • 2021-10-31
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-17
  • 2021-08-04
  • 2021-04-14
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-11-10
  • 2021-07-21
  • 2021-12-26
  • 2021-10-27
  • 2022-12-23
相关资源
相似解决方案