@alanscodelog/utils
    Preparing search index...

    Function browserSaveFile

    • Triggers a file download with the given name and contents (attempt to autodetect the type if not provided).

      Attempts to use the File System Access API first, falling back to temporarily appending a link element to the document body, clicking it, then quickly removing it.

      Note: In the latter case the download might be blocked or might prompt the user to allow multiple downloads after the first one if there is no user interaction with the page between each call.

      This means it can fail silently. Also we have no way of knowing if it worked or when/if the file downloaded.

      Parameters

      • name: string
      • contents: string | unknown[] | Blob | Record<string, unknown>
      • options: Pick<FilePropertyBag, "type"> & { useFileSystemApi?: boolean } = {}
        • OptionaluseFileSystemApi?: boolean

          Whether to attempt using the File System Access API, true by default.

      Returns Promise<void>

      browser