Base64 编码的字符串转换为 Blob 对象方法

const blob = function (data: string, mime: string) {
  data = data.split(',')[1];
  data = window.atob(data);
  let ia = new Uint8Array(data.length);
  for (var i = 0; i < data.length; i++) {
    ia[i] = data.charCodeAt(i);
  };
  return new Blob([ia], {
    type: mime
  });
};

 

posted on 2023-09-28 16:48  漫思  阅读(150)  评论(0编辑  收藏  举报

导航