chrome.system.storage
- Description
Use the
chrome.system.storage
API to query storage device information and be notified when a removable storage device is attached and detached. - Permissions
system.storage
Summary
- Types
- Methods
system.storage.ejectDevice(id: string, callback: function)
system.storage.getAvailableCapacity(id: string, callback: function)
system.storage.getInfo(callback: function)
- Events
Types
StorageAvailableCapacityInfo
Properties
- availableCapacitynumber
The available capacity of the storage device, in bytes.
- idstring
A copied
id
of getAvailableCapacity function parameterid
.
StorageUnitInfo
Properties
- capacitynumber
The total amount of the storage space, in bytes.
- idstring
The transient ID that uniquely identifies the storage device. This ID will be persistent within the same run of a single application. It will not be a persistent identifier between different runs of an application, or between different applications.
- namestring
The name of the storage unit.
- type
The media type of the storage unit.
EjectDeviceResultCode
Enum
"success"
, "in_use"
, "no_such_device"
, or "failure"
StorageUnitType
Enum
"fixed"
, "removable"
, or "unknown"
Methods
ejectDevice
system.storage.ejectDevice(id: string, callback: function)
Ejects a removable storage device.
Parameters
- idstring
- callbackfunction
The callback parameter should be a function that looks like this:
(result: EjectDeviceResultCode) => {...}
- result
getAvailableCapacity
system.storage.getAvailableCapacity(id: string, callback: function)
Get the available capacity of a specified id
storage device. The id
is the transient device ID from StorageUnitInfo.
Parameters
- idstring
- callbackfunction
The callback parameter should be a function that looks like this:
(info: StorageAvailableCapacityInfo) => {...}
getInfo
system.storage.getInfo(callback: function)
Get the storage information from the system. The argument passed to the callback is an array of StorageUnitInfo objects.
Parameters
- callbackfunction
The callback parameter should be a function that looks like this:
(info: StorageUnitInfo[]) => {...}
- info
Events
onAttached
system.storage.onAttached.addListener(listener: function)
Fired when a new removable storage is attached to the system.
Event
- listenerfunction
The listener parameter should be a function that looks like this:
(info: StorageUnitInfo) => {...}
- info
onDetached
system.storage.onDetached.addListener(listener: function)
Fired when a removable storage is detached from the system.
Event
- listenerfunction
The listener parameter should be a function that looks like this:
(id: string) => {...}
- idstring