UNPKG

@fgv/ts-web-extras

Version:

Browser-compatible utilities and FileTree implementations

105 lines (48 loc) 1.35 kB
<!-- Do not edit this file. It is automatically generated by API Documenter. --> [Home](./index.md) &gt; [@fgv/ts-web-extras](./ts-web-extras.md) &gt; [exportUsingFileSystemAPI](./ts-web-extras.exportusingfilesystemapi.md) ## exportUsingFileSystemAPI() function Export data using File System Access API with fallback to blob download. **Signature:** ```typescript export declare function exportUsingFileSystemAPI(data: unknown, suggestedName: string, description?: string, window?: Window): Promise<boolean>; ``` ## Parameters <table><thead><tr><th> Parameter </th><th> Type </th><th> Description </th></tr></thead> <tbody><tr><td> data </td><td> unknown </td><td> Data to export as JSON </td></tr> <tr><td> suggestedName </td><td> string </td><td> Suggested filename for the save dialog </td></tr> <tr><td> description </td><td> string </td><td> _(Optional)_ Description for file type filter (default: 'JSON files') </td></tr> <tr><td> window </td><td> Window </td><td> _(Optional)_ Window object for API access (default: globalThis.window) </td></tr> </tbody></table> **Returns:** Promise&lt;boolean&gt; Promise resolving to true if saved via File System Access API, false if fallback used