Is there anyway to access the base path of an uploaded file with Rust WASM? - rust

Does WebAssembly have the same issue as native JS(for very valid security reasons) that it cannot access the base/root path of any given uploaded file or selected folder? I want to write a Rust UI app with seed and using rfd (or its previous iterations nfd/nfd2) that users can indicate a file path so the application can install certain files in the correct place.
Otherwise can seed compile to a local .exe instead of a web based app, and therefore have proper access to the file system?
Thanks

Related

Can I read files from the disk by using Webassembly? (re-evaluated)

what's currently possible in webassembly running in the browser regarding accessing the local file system? There's an older question that says it's not possible due to security restrictions. But some places (e.g. https://fjolt.com/article/javascript-new-file-system-api) say that there's a new file system API available in some browsers that would allow that.
a) what needs to be done to be able to use that api?
b) can I use it from rust with webassembly - and how?
Thank you for any useful pointer.
Tobias
The current web APIs (https://developer.mozilla.org/en-US/docs/Web/API) only lets you access files in the local files system by prompting the user to open or save files.
These APIs are not (yet) accesible from webassembly directly. So what you have to do is
Use javascript to prompt the user to open a file (or directory)
Grab the contents of the file and pass it to your webassembly code
Process the contents with webassembly (or in your case rust compiled to webassembly)
Pass the processed content back to javascript that can prompt the user to save the file.
or some variation of the theme above.
Read more about webassmbly usage here
https://developer.mozilla.org/en-US/docs/WebAssembly/Using_the_JavaScript_API
and Rust and webassembly e.g. here
https://developer.mozilla.org/en-US/docs/WebAssembly/Rust_to_wasm

Need help in developing a custom WebDav client using node.js

I am developing an open source application which should mount webdav share to local drive letter just like NETDRIVE and WEBDRIVE using node.js and electron-js, so in my application at present I am downloading all files from webdav share which takes a lot of time and not reliable for heavy data. Is there any other approach so that whenever user access a file, only that particular file should be fetched from webdav share, I’ve tried to display files meta data(dummy) structure in directory and kept that directory under file-watcher. So that when user tries to open a file then watcher should capture file open event to get which file was user trying to access, so that in background of application a service will triggered to fetch that particular file using file-path as reference, but none of them are unable to capture file open event. Is there any other approach to do so, correct me if I am in wrong direction.
Thank's
I think you want virtual file-system and recommend Dokan library.
Dokan is the start point of Windows virtual file-system application.
Open Source : Dokan (https://en.wikipedia.org/wiki/Dokan_Library)
Commercial: EldoS CBFS (https://www.eldos.com/cbfs)
Google, Naver use Dokan and NetDrive, RaiDrive(mine) use CBFS.

Possible to set local folder for automatic file uploads

Bit of a loose question so if it gets marked down I'll remove it.. but..
I'm using Primefaces/Spring/Hibernate for Java server.
My application knows a load of file names I need to upload. Those files are on my local computer. Is it possible to tell the application the root directory of these files, for it to then setup uploads for each of these files without me needing to browse for each file individually?
I assume this is a browser security issue, i.e. the user needs to explicitly state which file the application is allowed to know about etc?
If not I'll have to do it in a local application but I was hoping there was a way a mass upload could be kicked off from the browser by just setting the local directory of the files.
I decided to use the Primefaces uploader, upload all the files in the directory and let the application sort them out once it has them on the server.

Can I keep the application settings when updating with installshield?

I finally managed to get my application updating through installshield LE, without the user having to uninstall manually first, what I am now wondering is:
Can I get the installer to use the application settings from the previous install, so the users saved settings don't change, causing the user to enter their settings every time there is an update. But at the same time, add any new settings to the config file.
Is there anyway to get the installer to not update certain files, for example, the database file is held in a folder called 'db' inside the program files directory, I obviously don't want the users database getting overwritten with a blank one.
Thank you.
Im not sure what programming language you are writing in, but I had this concern with a C# application I wrote. I see 2 easy ways of doing it:
1) With C# you can setup application setting variables that get written to an XML file in the users Application Data (on WinXP) directory. The nice thing about this is that writing to and reading from the settings file is really easy through the API:
To save and store a variable:
Properties.Settings.Default.UserName = UserName_txtbox.Text; // save contents of UserName_txtbox to UserName setting variable
Properties.Settings.Default.Save(); // write variable to file
To restore a variable:
UserName_txtbox.Text = Properties.Settings.Default.UserName; //load contents of UserName variable to UserName_txtbox
Because the file that contains these are not included in the installation directory of the application, they are preserved.
If you are using a different programming language, you can try to implement the same concept.
Create a settings file that your program updates externally from the install location. (Perhaps it can be in the install location. Im not sure how your installer "updates". Does it replace files or uninstall the old version and install the new version automatically? Play this this to find out...)
Your settings file can be a simple txt file, a bin file, an XML file, etc. Anything that you can read and parse easily. Then you can load settings from the file when the program loads and save settings to the file when the program exits.

access certain folder in azure cloud service

In my code (which has worker role) I need to specify a path to a directory (third party library requires it). Locally I've included folder into project and just give full path to it. However after deployment of course I need a new path. How do I confirm that whole folder has been deployed and how do I determine a new path to it?
Edit:
I added folder to the role node in visual studio and accessed it like this: Path.Combine(Environment.GetEnvironmentVariable("RoleRoot"), "my_folder");
Will this directory be used for reading and writing? If yes, you should use a LocalStorage resource. https://azure.microsoft.com/en-us/documentation/articles/cloud-services-configure-local-storage-resources/ shows how to use this.
If the directory is only for reading (ie. you have binaries or config files there), then you can use the %RoleRoot% environment variable to identify the path where your package was deployed to, then just append whatever folder you refernced in your project (ie. %RoleRoot%\Myfiles).
I'd take a slightly different approach. Place the 3rd party package into Windows Azure blob storage, then during role startup, you can download/extract it and place the files into the available Local storage (giving it whatever permissions the app needs). Then leverage that location from your application via the same local storage configuration entry.
This should help you reduce the size of your deployment package as well as give you the ability to update the 3rd party components without completely redeploying your solution. And by leveraging it on startup, you can guarantee that the files will be there in case the role instance gets torn down and rebuilt.

Resources