The File Handling API is part of the capabilities project and is currently in development. This post will be updated as the implementation progresses.

Let web applications be file handlers

submited by
Style Pass
2021-06-14 12:30:04

The File Handling API is part of the capabilities project and is currently in development. This post will be updated as the implementation progresses.

Now that web apps are capable of reading and writing files, the next logical step is to let developers declare these very web apps as file handlers for the files their apps can create and process. The File Handling API allows you to do exactly this. After registering a text editor app as a file handler, you can right-click a .txt file on macOS and select "Get Info" to then instruct the OS that it should always open .txt files with this app as default.

To experiment with the File Handling API locally, without an origin trial token, enable the #file-handling-api flag in about://flags.

The File Handling API per se cannot be polyfilled. The functionality of opening files with a web app, however, can be achieved through two other means:

As a first step, web apps need to declaratively describe in their web app manifest what kind of files they can handle. The File Handling API extends web app manifest with a new property called "file_handlers" that accepts an array of, well, file handlers. A file handler is an object with two properties:

Leave a Comment