StorageArea.getBytesInUse()

1 つ以上のストレージ領域内に格納されたアイテムが占めるストレージ空間をバイト単位で取得します。

この関数は Promise を返す非同期関数です。

構文

js
var gettingSpace = browser.storage.<storageType>.getBytesInUse(
  keys                      // null, string, or array of strings
)

<storageType>storage.sync または storage.local の書き込み可能なストレージタイプです。

引数

keys

ストレージ空間を取得したいアイテムのキー(文字列または文字列の配列)を指定します。 空の文字列か配列を渡すと 0 が返ります。 null を指定すると、ストレージ領域全体の使用中ストレージ空間を返します。

返り値

成功時は keys で指定されたオブジェクトが占めるストレージ空間を持つ整数 bytesUsed を引数に持つ Promise を返します。失敗した場合 Promise はエラーメッセージと共にリジェクトされます。

ブラウザーの互換性

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Firefox for Android
Safari on iOS
getBytesInUse

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support
See implementation notes.

メモ: この API は Chromium の chrome.storage API に基づいています。また、このドキュメントは storage.json における Chromium のコードに基づいています。Microsoft Edge での実装状況は Microsoft Corporation から提供されたものであり、ここでは Creative Commons Attribution 3.0 United States License に従っています。