Manifest - File Handlers
Published on • Updated on
Important: Chrome will be removing support for Chrome Apps on all platforms. Chrome browser and the Chrome Web Store will continue to support extensions. Read the announcement and learn more about migrating your app.
Used by packaged apps to specify what types of files the app can handle. An app can have multiple file_handlers
, with each one having an identifier, a list of MIME types and/or a list of file extensions that can be handled. The app can handle a file if it either has a matching file extension or has a matching MIME type. The app can also handle directories if include_directories
is set. You can use a wildcard "*"
in types
or extensions
to indicate that the app can handle any file type or "_type_/*"
in types
to indicate that the app can handle any file with a MIME type of _type_
. Here's an example of specifying file handlers:
"file_handlers": {
"text": {
"types": [
"text/*"
],
},
"image": {
"types": [
"image/png",
"image/jpeg"
],
"extensions": [
"tiff"
],
},
"any": {
"extensions": [
"*",
"include_directories": true
],
}
}
To handle files or directories, apps also need to declare the fileSystem permission. Apps can then be passed files or directories in the app.runtime.onLaunched event - either from the system file manager (currently supported on ChromeOS only) or by providing a path on the command line.
Updated on • Improve article