@mocanvas/editor · function
declare function dataUrlToFile(dataUrl: string, filename: string, mimeType?: string): Promise<File>Turn a data URL back into a File.
The inverse of the store below, and what a paste handler needs: a data URL on
the clipboard has to become a File before it can go through the same upload
path as a dropped one, so that an app's real storage sees both kinds
identically.
Throws on anything that is not a data: URL, because silently producing an
empty file would surface much later as a broken image.
mocanvas is built by Symbio. Free for non-commercial, non-profit and development use; commercial use needs an agreement. Not affiliated with or endorsed by tldraw.