@dxos/react-ui
    Preparing search index...

    Variable useFileDownloadConst

    useFileDownload: () => (data: Blob, filename: string) => void

    Save a blob to disk.

    Goes through downloadBlob, so the download also works inside the Tauri webview, where <a download> is silently dropped. Blob only: a URL would have to fall back to that anchor, and a caller has no way to notice it did nothing.

    const download = useFileDownload();
    const handleDownload = (data: string) => {
    download(new Blob([data], { type: 'text/plain' }), 'test.txt');
    };

    Type declaration

      • (): (data: Blob, filename: string) => void
      • Returns (data: Blob, filename: string) => void