urltoBlob.ts 264 B

12345678910
  1. /**
  2. * 通过一个图片的url加载所需要的File(Blob)对象
  3. *
  4. * @param {string} url - 图片URL
  5. * @returns {Promise(Blob)}
  6. *
  7. */
  8. export default function urltoBlob(url: string): Promise<Blob> {
  9. return fetch(url).then(response => response.blob());
  10. };