10 lines
225 B
TypeScript
10 lines
225 B
TypeScript
export async function dataUrlToFile(
|
|
url: string,
|
|
filename: string,
|
|
mimeType: string,
|
|
) {
|
|
const res = await fetch(url);
|
|
const buf = await res.arrayBuffer();
|
|
return new File([buf], filename, { type: mimeType });
|
|
}
|