Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/ayonli_jsext/esm/dialog.js>downloadFile

A JavaScript extension package for building strong and modern applications.
Latest
function downloadFile
import { downloadFile } from "https://deno.land/x/ayonli_jsext@v0.9.72/esm/dialog.js";

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

import { downloadFile } from "@ayonli/jsext/dialog";

await downloadFile("https://ayonli.github.io/jsext/README.md");

Parameters

url
optional
options = [UNSUPPORTED]