StorageArea.getBytesInUse()

Gets the amount of storage space, in bytes, used one or more items being stored in the storage area.

Syntax

chrome.storage.<storageType>.getBytesInUse(keys,callback);

<storageType> will be one of the writable storage types — storage.sync or storage.local.

Parameters

keys
A key (string) or keys (an array of strings) to identify the item(s) whose storage space you want to retrieve. If an empty string or array is passed in, 0 will be returned. If you pass null here, the function will return the space used by the entire storage area.
callback Optional
A callback function that is run when the operation completes. If the operation is successful, the function is passed an integer representing the storage space used by the objects that were specified in keys. If the operation fails, runtime.lastError is set.

Browser compatibility

EdgeFirefoxChromeOpera
Basic support?45.0Yes33
Firefox
Basic support48.0

Examples

Document Tags and Contributors

 Contributors to this page: wbamberg, chrisdavidmills
 Last updated by: wbamberg,