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.
|
Availability: |
Since Chrome 35.
|
Permissions: |
"system.storage"
|
Summary
Types | |
---|---|
StorageUnitInfo | |
Methods | |
getInfo −
chrome.system.storage.getInfo(function callback)
| |
ejectDevice −
chrome.system.storage.ejectDevice(string id, function callback)
| |
getAvailableCapacity −
chrome.system.storage.getAvailableCapacity(string id, function callback)
| |
Events | |
onAttached | |
onDetached |
Types
StorageUnitInfo
properties | ||
---|---|---|
string | id |
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. |
string | name |
The name of the storage unit. |
enum of "fixed" , "removable" , or "unknown" |
type |
The media type of the storage unit.
|
double | capacity |
The total amount of the storage space, in bytes. |
Methods
getInfo
chrome.system.storage.getInfo(function callback)
Get the storage information from the system. The argument passed to the callback is an array of StorageUnitInfo objects.
Parameters | |||||
---|---|---|---|---|---|
function | callback |
The callback parameter should be a function that looks like this: function(array of StorageUnitInfo info) {...};
|
ejectDevice
chrome.system.storage.ejectDevice(string id, function callback)
Ejects a removable storage device.
Parameters | |||||
---|---|---|---|---|---|
string | id | ||||
function | callback |
The callback parameter should be a function that looks like this: function(enum of
|
getAvailableCapacity
chrome.system.storage.getAvailableCapacity(string id, function callback)
Dev channel only. Learn more.
Get the available capacity of a specified |id| storage device. The |id| is the transient device ID from StorageUnitInfo.
Parameters | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
string | id |
Since Chrome 35. |
|||||||||
function | callback |
The callback parameter should be a function that looks like this: function(object info) {...};
|
Events
onAttached
Fired when a new removable storage is attached to the system.
addListener
chrome.system.storage.onAttached.addListener(function callback)
Parameters | |||||
---|---|---|---|---|---|
function | callback |
The callback parameter should be a function that looks like this: function( StorageUnitInfo info) {...};
|
onDetached
Fired when a removable storage is detached from the system.
addListener
chrome.system.storage.onDetached.addListener(function callback)
Parameters | |||||
---|---|---|---|---|---|
function | callback |
The callback parameter should be a function that looks like this: function(string id) {...};
|