Huang
Huang

Reputation: 1919

How can I create a Chrome Extension that can read & write local files?

I am writing a Google Chrome extension dealing with many user-defined rules, so instead of storing those rules in localstorage, I prefer a way which I could easily import/export these rules, like in a Firefox extension. Can I do that?

Upvotes: 4

Views: 2723

Answers (2)

user3766155
user3766155

Reputation: 21

  1. I am also trying to read/write from chrome extension to local disk. So far unsuccessful (it appears that for security reason chrome may never allow users to do so; I am not sure).
  2. From chrome app users can read/write to local drive (see also: http://sysmagazine.com/posts/212107/)
  3. From chrome app users can read/write to google drive (sorry lost my reference, but trust me you can do that)
  4. Using a native application (in python, for example) users can retrieve stuff from chrome extension (or probably also from chrome app) and then (of course) write to their local drive. I have not tried this approach. But according to: https://developer.chrome.com/extensions/messaging#native-messaging, I should be able to do so. There is a ready made example for you to download and try (sorry stackoverflow won't allow me to post more than 2 links).
  5. I think theoretically there should be a way to AJAX stuff from chrome extension to your local disk via a webserver/php

Upvotes: 0

Rick van Mook
Rick van Mook

Reputation: 2065

As far as I know Chrome extensions don't support reading or writing to disk. So no, you can't do it.

Upvotes: 2

Related Questions