Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / chrome / common / extensions / docs / templates / articles / manifest / file_handlers.html
1 <h1 id="file_handlers">Manifest - File Handlers</h1>
2
3 <p>
4 Used by <a href="../app_lifecycle.html#eventpage">packaged apps</a>
5 to specify what types of files the app can handle. An app can have multiple <code>file_handlers</code>, with each one having an identifier, a list of MIME types and/or a list of file extensions that can be handled, and
6 a title. Here's an example of specifying file handlers:
7 </p>
8
9 <pre data-filename="manifest.json">
10 "file_handlers": {
11   "text": {
12     "types": [
13       "text/*"
14     ],
15     "title": "Text editor"
16   },
17   "image": {
18     "types": [
19       "image/png",
20       "image/jpeg"
21     ],
22     "extensions": [
23       "tiff"
24     ],
25     "title": "Image editor"
26   },
27   "any": {
28     "extensions": [
29       "*"
30     ],
31     "title": "Any file type editor"
32   }
33 }
34 </pre>
35
36 <p>
37 To handle files, apps also need to declare the $ref:fileSystem
38 permission. Apps can then be passed files in the $ref:app.runtime.onLaunched
39 event - either from the system
40 file manager (currently supported on ChromeOS only) or by providing
41 a path on the <a href="../first_app.html#open">command line</a>.
42 </p>