Welcome What's new in Chrome extensions Getting started API Reference Samples

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

EjectDeviceResultCode

Type

"success"

,

"in_use"

,

"no_such_device"

,
or

"failure"

StorageAvailableCapacityInfo

Properties

  • availableCapacity

    number

    The available capacity of the storage device, in bytes.

  • id

    string

    A copied id of getAvailableCapacity function parameter id.

StorageUnitInfo

Properties

  • capacity

    number

    The total amount of the storage space, in bytes.

  • id

    string

    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.

  • name

    string

    The name of the storage unit.

  • The media type of the storage unit.

StorageUnitType

Type

"fixed"

,

"removable"

,
or

"unknown"

Methods

ejectDevice

chrome.system.storage.ejectDevice(
  id: string,
  callback?: function,
)
Promise

Ejects a removable storage device.

Parameters

Returns

  • Pending

    This only returns a Promise when the callback parameter is not specified, and with MV3+. The type inside the Promise is the same as the 1st argument to callback.

getAvailableCapacity

chrome.system.storage.getAvailableCapacity(
  id: string,
  callback?: function,
)
Promise

Get the available capacity of a specified id storage device. The id is the transient device ID from StorageUnitInfo.

Parameters

Returns

  • Pending

    This only returns a Promise when the callback parameter is not specified, and with MV3+. The type inside the Promise is the same as the 1st argument to callback.

getInfo

chrome.system.storage.getInfo(
  callback?: function,
)
Promise

Get the storage information from the system. The argument passed to the callback is an array of StorageUnitInfo objects.

Parameters

Returns

  • Promise<StorageUnitInfo[]>

    Pending

    This only returns a Promise when the callback parameter is not specified, and with MV3+. The type inside the Promise is the same as the 1st argument to callback.

Events

onAttached

chrome.system.storage.onAttached.addListener(
  callback: function,
)

Fired when a new removable storage is attached to the system.

Parameters

onDetached

chrome.system.storage.onDetached.addListener(
  callback: function,
)

Fired when a removable storage is detached from the system.

Parameters

  • callback

    function

    The callback parameter looks like: (id: string) => void

    • id

      string