1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import { fetch } from "https://esm.town/v/std/fetch";
export let fetchBlob = async (url: string, options?: any = {}) => {
const mimeType = options.mimeType || "audio/mpeg";
let f = await fetch(url, {
...options,
headers: {
"Content-Type": mimeType,
},
});
let blob = await f.blob();
try {
return blob;
} catch (e) {
throw new e.constructor(`${e.message} in ${url}\n\n"${t}"`);
}
};