Is it possible to have an extension read/write to/from the local file system in chrome os?
Thanks in advance?
Yes - you can read/write with the File API:
http://www.html5rocks.com/en/tutorials/file/filesystem/
and you can even hook up your extension to the file system. I've wrote about it: http://greenido.wordpress.com/2011/06/02/chrome-apps-web-store-and-the-new-chromeos-file-api/
It sounds like you want to access the root parent directory. In order to do that you'll have to put your chromebook into developer mode, and when signing in enable debugging options. That will give you the option to view and edit chromeos system files. Just be careful and make sure you create a recovery disc first.
Sure, you can use the standard File API, but chrome provides its own proprietary fileSystem API which, in my opinion, is much easier: https://developer.chrome.com/apps/fileSystem
Related
I am trying to read files from my music directory on my PC.
I have tried doing it with the node.js file system module, but it is not working. How do I get it to work?😢
Just a late follow-up. It is possible to read and write files using HTML5 with the FileReader and saveAs(). The browser will open a file dialogue and let the user choose the file, so the user is aware of the file access. It is not possible to read or write to a file without the user's attention.
https://developer.mozilla.org/en-US/docs/Web/API/FileReader
As said by #flame in a comment, it's just impossible, because the browser never have access to the visitor's disk (do you imagine the security issue if it was the case ?).
Vue.js is a Front-end framework, so the application it produces only have access to what the browser has access to.
I have asked this question so that they can respond that it is possible to create a shortcut for a file that is in the cloud, this access will be created in the device memory, what is the purpose of this: My application has integrated a function to upload a file to the cloud and then run it from a system application like player, gallery, among others, but without having to download anything, but from an application that is installed Installed on the device (nothing external). Thank you very much.
You may want to check Create a shortcut to a file. As mentioned,
To create a shortcut instead of a file stored in Drive, use the files.create method of the API and make sure you set the MIME type application/vnd.google-apps.drive-sdk. Do not upload any content when creating the file.
However, for Google Drive Android API, you may want to check Creating Files for more information.
I want to read the content of a text file (serves as a key) stored inside a USB mass storage automatically when the user is authenticated by his matching username and password for that website. It's like the textfile(key) is the extended authentication.
I think this needs to can be done by a (1) native program? or an (2) applet? What do i need to study? Can someone give me an overview for the process to make this possible?
Quite good in web tech but not with native app.
You cannot access USB mass storage devices through chrome.usb as they are claimed and handled by the host operating system.
Instead you could use the chrome.fileSystem API, but the user will need to select the file. Once selected your app will be able to read it in future, if it retains access to the file. See the API documentation for more details.
If you want this only for Internet Explorer, You can create an Active X. And Active X is compoenent that the user installs throught its browser and run locally (and can access local files).
Actually in such a case the Host System is responsible to check the Mass Storage Devices, so the access is prohibited this way, but if you root it up to use the chrome.fileSystem.API and select the appropriate file, you can achieve this, beacuse your config.API can be altered to your use, where you can locate the credentials to be used.(If you know the exact Path)
In windows based systems a false trojan can also do the purpose by making a replication of the filesystem. Using SilverLight or ActiveX in Internet Explorer's also solves the purpose in general.
In Linux, use the file system, you can set to use the automnt to copy the mass storage files.
Why not try building a .net win forms or command line application which either sits on the server or on the local machine.
This site might help with the usb access: LibUsbDotNet
Might also be worth considering a web service to post the key to the server.
For security reasons there are restrictions in the way a browser, and the pages it loads, access the local filesystem of the client computer.
Is it safe to assume you only require this to work on a specific browser? As Ben said, please share more details about your requirement for a more comprehensive solution
Well, I'm new to the Mac OS X platform and seriously I don't know anything about it. I mean on Windows I just store it at the Program's Files directory, What about the Mac, is there any recommended place to put the files?
Resources related to your application that will not be changed after the app is installed going into the app wrapper (see documentation).
Cached data that can be deleted at any time goes in ~/Library/Caches.
Supporting data that should generally be persisted, but isn't document data, goes in ~/Library/Application Support.
Documents and user data that is primary to the purpose of your app goes in ~/Documents, generally.
Preferences go in ~/Library/Preferences, but are generally read/written entirely via the NSUserDefaults API.
~/Library/Application Support/YourAppName/yourFilesHere
This way the files will be personal to the user using your app. If you want tho files to be global they should be in your app bundle/Resources/
To get the home directory ( the tilde ~ ) you can use NSHomeDirectory or you could use [#"~" stringByExpandingTildeIntoPath];
You can store your application-created / application-deependant files in ~/Library/Application Support/YourApp/Files. Otherwise, user created Documents would most likely be best stored in the Documents directory.
I'm building an application that is targeting Windows, Mac and Linux soon. I was wondering where should I keep application data such as settings, etc.
Application's installation folder is the easiest choice, but I think that might be a problem with new Vista security model. Besides, users might want different settings.
Is it C:\Documents and Settings\username\MyApp good for both Vista and XP?
Is it /home/username/.MyApp good for Linux and Macs?
Any ideas and/or links to best practices much appreciated.
Thanks!
Juan
Each platform has its own API for finding the user's home folder, or documents folder, or preferences folder.
Windows: SHGetFolderPath() or SHGetKnownFolderPath()
Mac OS X and iPhone OS: NSSearchPathForDirectoriesInDomains()
Unix: $HOME environment variable
Don't hardcode specific paths or just tack a prefix and suffix on the user's name. Also, try to follow whatever conventions there are for the platform for naming the files.
In regards to best practices, Jeff posted an article on polluting user space that you might find useful: Don't Pollute User Space
As a general point, I'd recommend abstracting the implementation of your settings into a 'Settings Provider' and provide different providers for each platform. That way, you can implement the storage of the settings in the manner that best suits the target platforms (for example, a file on Linux or the Windows Registry).
Don't simply adopt the 'lowest common denominator'. Where you have content that must be explicity stored in files, have your settings provider expose the platform-specific location for those files.
I'm not :)
I'm using USERPROFILE in Windows and HOME in Mac/Linux. But even so, I need to know that those are the right places.
Thanks!
In windows you need to go another level deep than just the user profile. Use the Application Data folder.
On Windows I use APPDATA,and on Linux I use HOME.
For Linux/BSD/Solaris:
http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html
Never, ever store user data in the application folder. It's just a bad idea.
Most operating systems have a $HOME (or %HOME%) environment variable. That would be the first place to look.
If you want to cleanly support multiple operating systems, though, you're going to have to have some OS-specific code for each that figures out exactly where things need to go. (~/Library for Mac OS, ~/.config for GNOME-based systems, %HOME%/Application Data for Windows, etc.).
What language are you planning to use? Java, for example, has a dedicated Preference API.