mirror of
https://github.com/getpaseo/paseo.git
synced 2026-11-08 09:24:41 +00:00
12 lines
482 B
JavaScript
12 lines
482 B
JavaScript
import { dialog, promises } from "@react-native-gpui/fs";
|
|
// Linux exports a downloaded file through the native Save dialog.
|
|
export const isAvailableAsync = async () => true;
|
|
export async function shareAsync(uri, options = {}) {
|
|
const source = uri.replace(/^file:\/\//, "");
|
|
const destination = await dialog.save({
|
|
title: options.dialogTitle ?? "Save file",
|
|
defaultName: source.split("/").at(-1),
|
|
});
|
|
if (destination) await promises.copyFile(source, destination);
|
|
}
|