Back to Chrome Extensions Samples

Cookbook - File Handling

functional-samples/cookbook.file_handlers/README.md

latest1.2 KB
Original Source

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.

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".