1
0
Fork 0
mirror of https://github.com/marcrobledo/RomPatcher.js.git synced 2025-06-27 16:25:54 +00:00
RomPatcher.js/public/scripts/tauriSaveFile.js

15 lines
383 B
JavaScript
Raw Normal View History

2024-06-05 11:21:57 +02:00
const { save } = window.__TAURI__.dialog;
const { writeBinaryFile } = window.__TAURI__.fs;
const tauriSaveFile = async (filename, blob) => {
try {
const path = await save({ defaultPath: filename });
const contents = await blob.arrayBuffer();
if (path && contents) {
await writeBinaryFile({ path, contents });
}
} catch (err) {
console.log(err);
}
};