import { saveFile } from "https://deno.land/x/ayonli_jsext@v0.9.72/dialog.ts";
Saves a file 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.
Examples
Example 1
Example 1
import { saveFile } from "@ayonli/jsext/dialog";
const file = new File(["Hello, World!"], "hello.txt", { type: "text/plain" });
await saveFile(file);
Parameters
file: File
optional
options: Pick<SaveFileOptions, "title">Examples
Example 1
Example 1
import { saveFile } from "@ayonli/jsext/dialog";
import bytes from "@ayonli/jsext/bytes";
const data = bytes("Hello, World!");
await saveFile(data, { name: "hello.txt", type: "text/plain" });
Parameters
optional
options: SaveFileOptions