New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[feat] Getting access to assets #5225
Comments
My suggestion would be to use the |
I actually don't need to access the file from frontend, only to copy the asset to a directory (to Desktop f.e.). I have looked up the So far, I have found these articles and still no way of how to figure |
Yeah i understood that, but by including it in the distDir folder, it is part of the frontend, which means you'd need to use frontend tech to access it. If we'd create a
There is a WIP guide here https://deploy-preview-893--tauri.netlify.app/v1/guides/building/resources - Feedback would be much appreciated before we merge :) Just keep in mind that it's supposed to be simple and not show every single possibility for now. A rundown for your specific usecase:
|
So far I have tried adding a path to "resources": [
"../node_modules/@tempest/extension/dist/*"
] And the FE code const thePath = await resolveResource('extension');
console.log(thePath);
console.log(await readDir(await resolveResource(''))); Here's the output of the production version: "/Applications/Tempest.app/Contents/MacOS/../Resources/extension"
"cannot traverse directory, rewrite the path without the use of `../`" and the development version:
When I check the At this point, I feel that the Resources can be declared as; "resources": {
"extension": "../node_modules/@tempest/extension/dist/*"
}, Then we could access it with the following: const thePath = await resolveResource('extension');
// Which would return the path without the traverse thing `../` |
We're thinking about something similar for the future, yeah. the stupid |
Describe the problem
I'm trying to copy a file stored inside the app, but I couldn't find a way to achieve. I'm simply using Vite on a project, it basically imports any file into assets directory when I import a file with
?url
suffix.For example, I can import the file like this:
I assumed that this path would be enough to use it with resolveResource and copy the file as I needed with the following code
Describe the solution you'd like
To be honest, the easiest solution would be, a new or an existing API which could allow me to access the file like accessing a file on a host and run FS-related actions on it (i.e. copy).
Alternatives considered
As suggested in the help channel on Discord server, I have peeked at
app.asset_resolver().get("/abs/path/to/file")
suggestion however, the solution that I need is in the JS environment.Additional context
No response
The text was updated successfully, but these errors were encountered: