chrome.system.storage
- DescriptionUse the chrome.system.storageAPI to query storage device information and be notified when a removable storage device is attached and detached.
- Permissions
Summary
- Types
- Methods
- Events
Types
EjectDeviceResultCode
Type
"success"
,"in_use"
,"no_such_device"
, or"failure"
StorageAvailableCapacityInfo
Properties
- availableCapacitynumber The available capacity of the storage device, in bytes. 
- idstring A copied idof 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. 
- typeThe media type of the storage unit. 
StorageUnitType
Type
"fixed"
,"removable"
, or"unknown"
Methods
ejectDevice
          
          
            chrome.system.storage.ejectDevice(
        id:
  string,
        callback?:
  function,
      
    )
          
        Ejects a removable storage device.
Parameters
- idstring 
- callbackfunction optional The callbackparameter looks like:(result: EjectDeviceResultCode) => void- result
 
Returns
- Promise<EjectDeviceResultCode> Chrome 91+- Promises are supported in Manifest V3 and later, but callbacks are provided for backward compatibility. You cannot use both on the same function call. The promise resolves with the same type that is passed to the callback. 
getAvailableCapacity
          
          
            chrome.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 optional The callbackparameter looks like:(info: StorageAvailableCapacityInfo) => void
Returns
- Promise<StorageAvailableCapacityInfo> - Promises are supported in Manifest V3 and later, but callbacks are provided for backward compatibility. You cannot use both on the same function call. The promise resolves with the same type that is passed to the callback. 
getInfo
          
          
            chrome.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 optional The callbackparameter looks like:(info: StorageUnitInfo[]) => void- info
 
Returns
- Promise<StorageUnitInfo[]> Chrome 91+- Promises are supported in Manifest V3 and later, but callbacks are provided for backward compatibility. You cannot use both on the same function call. The promise resolves with the same type that is passed to the callback. 
Events
onAttached
          
          
            chrome.system.storage.onAttached.addListener(
        callback:
  function,
      
    )
          
        Fired when a new removable storage is attached to the system.
Parameters
- callbackfunction The callbackparameter looks like:(info: StorageUnitInfo) => void- info
 
onDetached
          
          
            chrome.system.storage.onDetached.addListener(
        callback:
  function,
      
    )
          
        Fired when a removable storage is detached from the system.
Parameters
- callbackfunction The callbackparameter looks like:(id: string) => void- idstring