File System Provider API: Mount, Metadata, Watchers and Cloud Files
How Chrome extension fileSystemProvider mounts virtual volumes, handles file operations, cloud metadata, and directory watching on ChromeOS.
This page summarizes Google Chrome documentation for the File System Provider API (chrome.fileSystemProvider / browser.fileSystemProvider). The API lets a Chrome extension expose a remote or virtual file tree in the ChromeOS Files app so users can browse, open, and—when permitted—edit files as if they were on a local volume.
fileSystemProvider: what it is and when to use it
Section titled “fileSystemProvider: what it is and when to use it”fileSystemProvider is the bridge between your extension’s storage backend and ChromeOS’s file UI. You register a volume with a unique fileSystemId, answer filesystem requests through event listeners, and call success or failure callbacks so the system can show entries, stream bytes, and notify watchers.
Use it when you need a mounted volume in Files (cloud drive, team share, device sync), not when you only need a one-off file picker—that pattern belongs to the legacy Chrome Apps fileSystem API (chooseEntry, volumeId, read-only vs writable).
Typical reader situations:
- Building a ChromeOS extension that surfaces cloud or corporate storage in Files.
- Debugging missing metadata, broken read/write after
onOpenFileRequested, or watchers that stop after reboot. - Adding offline pin, share, or other entry actions the Files app exposes via your provider.
Mount configuration: fileSystemId, persistence, and limits
Section titled “Mount configuration: fileSystemId, persistence, and limits”Mounting defines how Files labels the volume and what the framework may assume about your backend.
When you configure a file system, you supply a human-readable displayName and a fileSystemId that must be unique per extension:
The string indentifier of the file system. Must be unique per each extension.
Optional mount flags shape behavior:
| Option | Meaning |
|---|---|
writable |
Whether create/delete/write operations are allowed. |
persistent |
Whether the framework should resume the file system at the next sign-in session (default true, Chrome 64+). |
openedFilesLimit |
Max open files at once; 0 or omitted means unlimited. |
supportsNotifyTag |
Whether your provider supports the tag field on directory observations (needed for some change notifications after shutdown). |
The mounted volume exposes runtime state such as openedFiles, watchers, and the same capability flags—useful when verifying leaks (files left open) or stale watchers.
Request lifecycle: requestId, open handles, and abort
Section titled “Request lifecycle: requestId, open handles, and abort”Almost every provider operation is a request/response pair. The event detail includes a numeric requestId—the unique identifier for that operation—and often paths under your volume root.
Opening a file is special: onOpenFileRequested supplies mode (OpenFileMode: read or write) and returns an openRequestId reused by subsequent read, write, truncate, and close requests for that handle:
A request ID which will be used by consecutive read/write and close requests.
— Google, fileSystemProvider API reference
Read and write payloads tie bytes to that handle:
- Read:
offset,length,openRequestId,requestId. - Write:
data(ArrayBuffer),offset,openRequestId,requestId.
Abort uses operationRequestId to cancel an in-flight operation while keeping requestId for the abort call itself.
Supported file and directory operations
Section titled “Supported file and directory operations”For a writable volume, the cluster documents symmetric CRUD-style operations (each with fileSystemId, requestId, and paths):
- Create file (
filePath) and create directory (directoryPath, optionalrecursive). - Delete entry (
entryPath, optionalrecursivefor directories). - Copy and move (
sourcePath,targetPath). - Truncate (
filePath,lengthbytes retained).
Read-only providers should reject mutating requests according to your product rules; the platform still sends events if writable was advertised incorrectly.
Metadata requests: optional fields and cloud entries
Section titled “Metadata requests: optional fields and cloud entries”onGetMetadataRequested and directory listing metadata use boolean flags in the options object—set a field to true only when you will fill the corresponding property in the response. Requested properties include name, isDirectory, mimeType, modificationTime, size, thumbnail, cloudIdentifier, and cloudFileInfo.
Response EntryMetadata must honor “requested means required”:
Must be provided if requested in options.
— Google, fileSystemProvider API reference
Important constraints from the same reference:
name: entry name only, not a full path; must not contain/; empty for root.thumbnail: data URI (PNG, JPEG, or WEBP), at most 32 KB, only when explicitly requested.cloudIdentifier: required when requested and the file is cloud-backed; undefined for local entries.cloudFileInfo: identifies the file in the underlying cloud FS when requested (Chrome 125+).
Cloud identity also appears in CloudFileInfo / provider naming:
Identifier for the cloud storage provider (e.g. ‘drive.google.com’).
— Google, fileSystemProvider API reference
Watching directories: observeDirectory, tag, and ChangeType
Section titled “Watching directories: observeDirectory, tag, and ChangeType”To refresh the Files UI when content changes, you implement observe / unobserve and emit change notifications.
Observation requests include entryPath, recursive (directories only), and requestId. Active watchers track entryPath, recursive, and optional lastTag.
When supportsNotifyTag was set at mount time, notifications must include a tag:
Tag for the notification. Required if the file system was mounted with the supportsNotifyTag option. Note, that this flag is necessary to provide notifications about changes which changed even when the system was shutdown.
A notification payload includes changeType, observedPath, fileSystemId, recursive, optional changes[], and optional cloudFileInfo on changed entries. If changeType is DELETED for an observed entry, the platform removes that entry from the observed list automatically—do not rely on manual cleanup alone.
Entry actions: SHARE, offline pin, and custom actions
Section titled “Entry actions: SHARE, offline pin, and custom actions”From Chrome 45+, onGetActionsRequested returns actions for one or more entryPaths; onExecuteActionRequested runs an actionId on entryPaths.
Built-in CommonActionId values include:
“SHARE” is for sharing files with others. “SAVE_FOR_OFFLINE” for pinning (saving for offline access). “OFFLINE_NOT_NECESSARY” for notifying that the file doesn’t need to be stored for offline access anymore. Used by onGetActionsRequested and onExecuteActionRequested.
Custom actionId strings are valid when your UI and backend agree on their meaning.
fileBrowserHandler: opening files from the ChromeOS Files app
Section titled “fileBrowserHandler: opening files from the ChromeOS Files app”Separate from mounting, fileBrowserHandler wires context-menu actions in the ChromeOS file browser to your extension. When the user runs an action, onExecute receives FileHandlerExecuteEventDetails:
Event details payload for fileBrowserHandler.onExecute event.
— Google, fileBrowserHandler API reference
The payload includes:
entries:Entryinstances for the selected files.tab_id(optional): the tab that raised the event (unique within the browser session).
Pair fileSystemProvider (volume in Files) with fileBrowserHandler (custom “open with” workflows) when users should both browse your storage and launch your app on a selection.
Related Chrome file APIs (different jobs)
Section titled “Related Chrome file APIs (different jobs)”| API | Role |
|---|---|
chrome.fileSystem (Apps) |
User-driven pickers: openFile, saveFile, accepts, volumeId, optional writable volume. |
chrome.app.runtime |
Launch packaged apps via file_handlers / url_handlers (items, LaunchItem.entry, MIME type). |
chrome.syncFileSystem |
Google Drive–backed sync status (synced, pending, conflicting) and sync direction—not a general provider. |
Do not confuse syncFileSystem status events with fileSystemProvider watch notifications; they solve different integration models.
Common mistakes
Section titled “Common mistakes”- Advertising
writable: truebut rejecting create/write events—Files will show errors users blame on the OS. - Omitting metadata fields that were requested in the event options.
- Reusing
openRequestIdacross unrelated files or forgetting to pair read/write with the ID fromonOpenFileRequested. - Enabling
supportsNotifyTagbut omittingtagon notifications, especially after restart. - Shipping thumbnails larger than 32 KB or full paths in
name(slashes are invalid).
How to check this on your site
Section titled “How to check this on your site”- On a ChromeOS device or suitable test image, load your unpacked extension and confirm the volume appears under Files with the expected
displayName. - Trigger
onGetMetadataRequestedon a cloud-backed file and verifycloudIdentifier/cloudFileInfoonly when requested and defined for local files per the API reference. - Open a file for read, perform a ranged read with
offset/length, then close—confirm each step uses the sameopenRequestIddocumented ononOpenFileRequested. - Change a watched directory and confirm notifications include
tagif the volume was mounted withsupportsNotifyTag. - You can check automatically in Answerwell (our tool): https://answerwell.org/workspace
Report an error or ask a question
Section titled “Report an error or ask a question”If something on this page is wrong or unclear, email yimasynthetic@gmail.com with the page URL and the exact sentence you are asking about, and we will correct or clarify it.