2

I know about file system api exposed to native client but it seems it can not allow access outside sandbox. There is an api which can allow access outside sandbox by a prompt window.

If my understanding is correct it can not allow access to a directory. I recently came across chrome dev which allow you to create workspace in any directory and allows cut, copy and paste operations even at directory level. I am wondering how are they getting the access to files and directory outside sandbox.

The extension which I am referring is: https://github.com/dart-lang/chromedeveditor

Badal Singh
  • 918
  • 1
  • 6
  • 13

1 Answers1

6

Chrome Dev Editor is not a Chrome extension, but a Chrome App. Chrome Apps can use the chrome.fileSystem API to read and write to directories and files that are selected by a user.

Extensions can only access a sandboxed filesystem using the non-extension-specific FileSystem API. The only API that allows extensions to write outside the virtual filesystem is chrome.downloads.download, which allows extensions to save a file to a directory as chosen by the user. After this operation, an extension can delete, but not modify the (downloaded) file.

(and if your extension requests the file://*/* or <all_urls> permission and the user ticks the "Allow access to file URLs" checkbox at the Extensions page, then your extension will have read-only access to the user's filesystem; if you want to pursue this method, read https://stackoverflow.com/a/19493206)

Community
  • 1
  • 1
Rob W
  • 341,306
  • 83
  • 791
  • 678