import { downloadFile } from "https://deno.land/x/ayonli_jsext@v0.9.72/dialog.ts";
Downloads the file of the given URL to the file system.
In the CLI, this function will open a dialog to let the user choose the location where the file will be saved. In the browser, the file will be saved to the default download location, or the browser will prompt the user to choose a location.
NOTE: This function depends on the Fetch API and Web Streams API, in Node.js, it requires Node.js v18.0 or above.
Examples
Example 1
Example 1
import { downloadFile } from "@ayonli/jsext/dialog";
await downloadFile("https://ayonli.github.io/jsext/README.md");
Parameters
url: string | URL
optional
options: DownloadFileOptions = [UNSUPPORTED]