chrome-extensions-samples/functional-samples/cookbook.file_handlers
Oliver Dunk d2296fac85
Update dependencies (#1096)
Updates a nunber of dependencies in a single PR. These were
suggested by dependabot but updating them individually would
mean the reposistory would be in a broken state until everything
had merged.

I'm not personally a huge fan of lowercasing doctype, but
Prettier has taken an opinionated stance here and there is not a
way to disable it:

https://github.com/prettier/prettier/issues/15096
2024-02-20 12:53:23 +01:00
..
README.md Add File Handling API / file_handlers sample (#1024) 2023-11-01 19:49:32 +00:00
manifest.json Add File Handling API / file_handlers sample (#1024) 2023-11-01 19:49:32 +00:00
screenshot.png Add File Handling API / file_handlers sample (#1024) 2023-11-01 19:49:32 +00:00
view-file.html Update dependencies (#1096) 2024-02-20 12:53:23 +01:00
view-file.js Add File Handling API / file_handlers sample (#1024) 2023-11-01 19:49:32 +00:00

README.md

Cookbook - File Handling

This sample demonstrates file handling in an extension.

Overview

On ChromeOS only, extensions can use the file_handlers manifest key to register as a file handler for particular file types. This behaves in a similar way to the equivalent key in web applications. As with web applications, you use the Launch Handler API to open and process a file.

This extension lets you open text files and see their name and size on the opened extension page. This could be a good starting point for building an extension that displays or interacts with an opened file.

Screenshot showing the File Handling API demo running in Chrome.

Running this extension

This API is only supported on ChromeOS.

  1. Clone this repository.
  2. Load this directory in Chrome as an unpacked extension.
  3. Create a text file on your ChromeOS device.
  4. In the Files app, select the file.
  5. In the toolbar, choose "Open" and then "File Handling Demo".