A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://developer.chrome.com/docs/extensions/reference/api/fileSystemProvider below:

chrome.fileSystemProvider | API | Chrome for Developers

Skip to main content chrome.fileSystemProvider

Stay organized with collections Save and categorize content based on your preferences.

Important: This API works only on ChromeOS. Description

Use the chrome.fileSystemProvider API to create file systems, that can be accessible from the file manager on Chrome OS.

Permissions

fileSystemProvider

Availability

You must declare the "fileSystemProvider" permission and section in the extension manifest to use the File System Provider API. For example:

{
  "name": "My extension",
  ...
  "permissions": [
    "fileSystemProvider"
  ],
  ...
  "file_system_provider_capabilities": {
    "configurable": true,
    "watchable": false,
    "multiple_mounts": true,
    "source": "network"
  },
  ...
}

The file_system_provider section must be declared as follows:

configurable (boolean) - optional
Whether configuring via onConfigureRequested is supported. By default: false.
multiple_mounts (boolean) - optional
Whether multiple (more than one) mounted file systems are supported. By default: false.
watchable (boolean) - optional
Whether setting watchers and notifying about changes is supported. By default: false.
source (enum of "file", "device", or "network") - required
Source of data for mounted file systems.

Files app uses above information in order to render related UI elements appropriately. For example, if configurable is set to true, then a menu item for configuring volumes will be rendered. Similarly, if multiple_mounts is set to true, then Files app will allow to add more than one mount points from the UI. If watchable is false, then a refresh button will be rendered. Note, that if possible you should add support for watchers, so changes on the file system can be reflected immediately and automatically.

Overview

File System Provider API allows extensions to support virtual file systems, which are available in the file manager on ChromeOS. Use cases include decompressing archives and accessing files in a cloud service other than Drive.

Mounting file systems

Providing extensions can either provide file system contents from an external source (such as a remote server or a USB device), or using a local file (such as an archive) as its input.

In order to write file systems which are file handlers (source is "file") the provider must be a packaged app, as the onLaunched event is not available to extensions.

If the source is network or a device, then the file system should be mounted when onMountRequested event is called.

Source of the file system data Entry point "file" Available to packaged apps only. "device" or "network" onMountRequested Configuring file systems

Provided file systems once mounted can be configured via the onConfigureRequested event. It's especially useful for file systems which provide contents via network in order to set proper credentials. Handling this event is optional.

Life cycle

Provided file systems once mounted are remembered by Chrome and remounted automatically after reboot or restart. Hence, once a file system is mounted by a providing extension, it will stay until either the extension is unloaded, or the extension calls the unmount method.

Types Properties Properties

AddWatcherRequestedOptions

Properties Properties

ChangeType

Type of a change detected on the observed directory.

CloseFileRequestedOptions

Properties Properties Properties

CommonActionId

List of common actions. "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.

Enum

"SAVE_FOR_OFFLINE"

"OFFLINE_NOT_NECESSARY"

"SHARE"

ConfigureRequestedOptions

Properties

CopyEntryRequestedOptions

Properties

CreateDirectoryRequestedOptions

Properties

CreateFileRequestedOptions

Properties

DeleteEntryRequestedOptions

Properties Properties

ExecuteActionRequestedOptions

Properties Properties

GetActionsRequestedOptions

Properties

GetMetadataRequestedOptions

Properties Properties

MoveEntryRequestedOptions

Properties Properties Properties Properties

ProviderError

Error codes used by providing extensions in response to requests as well as in case of errors when calling methods of the API. For success, "OK" must be used.

Enum

"OK"

"FAILED"

"IN_USE"

"EXISTS"

"NOT_FOUND"

"ACCESS_DENIED"

"TOO_MANY_OPENED"

"NO_MEMORY"

"NO_SPACE"

"NOT_A_DIRECTORY"

"INVALID_OPERATION"

"SECURITY"

"ABORT"

"NOT_A_FILE"

"NOT_EMPTY"

"INVALID_URL"

"IO"

ReadDirectoryRequestedOptions

Properties Properties

RemoveWatcherRequestedOptions

Properties Properties Properties Properties Properties

WriteFileRequestedOptions

Properties Methods

get()

chrome.fileSystemProvider.get(
  fileSystemId: string,
)
: Promise<FileSystemInfo>

Returns information about a file system with the passed fileSystemId.

getAll()

chrome.fileSystemProvider.getAll(): Promise<FileSystemInfo[]>

Returns all file systems mounted by the extension.

mount()

chrome.fileSystemProvider.mount(
  options: MountOptions,
)
: Promise<void>

Mounts a file system with the given fileSystemId and displayName. displayName will be shown in the left panel of the Files app. displayName can contain any characters including '/', but cannot be an empty string. displayName must be descriptive but doesn't have to be unique. The fileSystemId must not be an empty string.

Depending on the type of the file system being mounted, the source option must be set appropriately.

In case of an error, runtime.lastError will be set with a corresponding error code.

notify()

chrome.fileSystemProvider.notify(
  options: NotifyOptions,
)
: Promise<void>

Notifies about changes in the watched directory at observedPath in recursive mode. If the file system is mounted with supportsNotifyTag, then tag must be provided, and all changes since the last notification always reported, even if the system was shutdown. The last tag can be obtained with getAll.

To use, the file_system_provider.notify manifest option must be set to true.

Value of tag can be any string which is unique per call, so it's possible to identify the last registered notification. Eg. if the providing extension starts after a reboot, and the last registered notification's tag is equal to "123", then it should call notify for all changes which happened since the change tagged as "123". It cannot be an empty string.

Not all providers are able to provide a tag, but if the file system has a changelog, then the tag can be eg. a change number, or a revision number.

Note that if a parent directory is removed, then all descendant entries are also removed, and if they are watched, then the API must be notified about the fact. Also, if a directory is renamed, then all descendant entries are in fact removed, as there is no entry under their original paths anymore.

In case of an error, runtime.lastError will be set will a corresponding error code.

unmount()

chrome.fileSystemProvider.unmount(
  options: UnmountOptions,
)
: Promise<void>

Unmounts a file system with the given fileSystemId. It must be called after onUnmountRequested is invoked. Also, the providing extension can decide to perform unmounting if not requested (eg. in case of lost connection, or a file error).

In case of an error, runtime.lastError will be set with a corresponding error code.

Events

onAbortRequested

chrome.fileSystemProvider.onAbortRequested.addListener(
  callback: function,
)

Raised when aborting an operation with operationRequestId is requested. The operation executed with operationRequestId must be immediately stopped and successCallback of this abort request executed. If aborting fails, then errorCallback must be called. Note, that callbacks of the aborted operation must not be called, as they will be ignored. Despite calling errorCallback, the request may be forcibly aborted.

Parameters

onAddWatcherRequested

chrome.fileSystemProvider.onAddWatcherRequested.addListener(
  callback: function,
)

Raised when setting a new directory watcher is requested. If an error occurs, then errorCallback must be called.

Parameters

onCloseFileRequested

chrome.fileSystemProvider.onCloseFileRequested.addListener(
  callback: function,
)

Raised when opening a file previously opened with openRequestId is requested to be closed.

Parameters

onConfigureRequested

chrome.fileSystemProvider.onConfigureRequested.addListener(
  callback: function,
)

Raised when showing a configuration dialog for fileSystemId is requested. If it's handled, the file_system_provider.configurable manfiest option must be set to true.

Parameters

onCopyEntryRequested

chrome.fileSystemProvider.onCopyEntryRequested.addListener(
  callback: function,
)

Raised when copying an entry (recursively if a directory) is requested. If an error occurs, then errorCallback must be called.

Parameters

onCreateDirectoryRequested

chrome.fileSystemProvider.onCreateDirectoryRequested.addListener(
  callback: function,
)

Raised when creating a directory is requested. The operation must fail with the EXISTS error if the target directory already exists. If recursive is true, then all of the missing directories on the directory path must be created.

Parameters

onCreateFileRequested

chrome.fileSystemProvider.onCreateFileRequested.addListener(
  callback: function,
)

Raised when creating a file is requested. If the file already exists, then errorCallback must be called with the "EXISTS" error code.

Parameters

onDeleteEntryRequested

chrome.fileSystemProvider.onDeleteEntryRequested.addListener(
  callback: function,
)

Raised when deleting an entry is requested. If recursive is true, and the entry is a directory, then all of the entries inside must be recursively deleted as well.

Parameters

onExecuteActionRequested

chrome.fileSystemProvider.onExecuteActionRequested.addListener(
  callback: function,
)

Raised when executing an action for a set of files or directories is\ requested. After the action is completed, successCallback must be called. On error, errorCallback must be called.

Parameters

onGetActionsRequested

chrome.fileSystemProvider.onGetActionsRequested.addListener(
  callback: function,
)

Raised when a list of actions for a set of files or directories at entryPaths is requested. All of the returned actions must be applicable to each entry. If there are no such actions, an empty array should be returned. The actions must be returned with the successCallback call. In case of an error, errorCallback must be called.

Parameters

onGetMetadataRequested

chrome.fileSystemProvider.onGetMetadataRequested.addListener(
  callback: function,
)

Raised when metadata of a file or a directory at entryPath is requested. The metadata must be returned with the successCallback call. In case of an error, errorCallback must be called.

Parameters

onMountRequested

chrome.fileSystemProvider.onMountRequested.addListener(
  callback: function,
)

Raised when showing a dialog for mounting a new file system is requested. If the extension/app is a file handler, then this event shouldn't be handled. Instead app.runtime.onLaunched should be handled in order to mount new file systems when a file is opened. For multiple mounts, the file_system_provider.multiple_mounts manifest option must be set to true.

Parameters

onMoveEntryRequested

chrome.fileSystemProvider.onMoveEntryRequested.addListener(
  callback: function,
)

Raised when moving an entry (recursively if a directory) is requested. If an error occurs, then errorCallback must be called.

Parameters

onOpenFileRequested

chrome.fileSystemProvider.onOpenFileRequested.addListener(
  callback: function,
)

Raised when opening a file at filePath is requested. If the file does not exist, then the operation must fail. Maximum number of files opened at once can be specified with MountOptions.

Parameters

onReadDirectoryRequested

chrome.fileSystemProvider.onReadDirectoryRequested.addListener(
  callback: function,
)

Raised when contents of a directory at directoryPath are requested. The results must be returned in chunks by calling the successCallback several times. In case of an error, errorCallback must be called.

Parameters

onReadFileRequested

chrome.fileSystemProvider.onReadFileRequested.addListener(
  callback: function,
)

Raised when reading contents of a file opened previously with openRequestId is requested. The results must be returned in chunks by calling successCallback several times. In case of an error, errorCallback must be called.

Parameters

onRemoveWatcherRequested

chrome.fileSystemProvider.onRemoveWatcherRequested.addListener(
  callback: function,
)

Raised when the watcher should be removed. If an error occurs, then errorCallback must be called.

Parameters

onTruncateRequested

chrome.fileSystemProvider.onTruncateRequested.addListener(
  callback: function,
)

Raised when truncating a file to a desired length is requested. If an error occurs, then errorCallback must be called.

Parameters

onUnmountRequested

chrome.fileSystemProvider.onUnmountRequested.addListener(
  callback: function,
)

Raised when unmounting for the file system with the fileSystemId identifier is requested. In the response, the unmount API method must be called together with successCallback. If unmounting is not possible (eg. due to a pending operation), then errorCallback must be called.

Parameters

onWriteFileRequested

chrome.fileSystemProvider.onWriteFileRequested.addListener(
  callback: function,
)

Raised when writing contents to a file opened previously with openRequestId is requested.

Parameters

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-08-11 UTC.

[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-11 UTC."],[],[]]


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4