Quantcast
Channel: Active questions tagged svelte - Stack Overflow
Viewing all articles
Browse latest Browse all 1541

With Tauri how can i save a file to a specific path?

$
0
0

I have this code:

async function downloadMod(url, folder, basePath) {        const httpclient = await getClient();        const file = await httpclient.get(url, {          responseType: ResponseType.Binary        });        invoke("expand_scope", { folderPath: basePath }) // Used to allow writes in whatever folder i want        await writeTextFile( url.split('#')[0].split('?')[0].split('/').pop(), Uint8Array.from(file.data), { dir:  BaseDirectory.Desktop });}

How can i save the file to basePath + folder and if basePath's folder folder dosent exists create one?

Im on windows btw...

I tried using the string as the path but it didnt work, it didnt spit out an error but didnt create the file...


Viewing all articles
Browse latest Browse all 1541

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>