files/en-us/web/api/storagemanager/estimate/index.md
{{securecontext_header}}{{APIRef("Storage")}} {{AvailableInWorkers}}
The estimate() method of the {{domxref("StorageManager")}} interface asks the Storage Manager for how much storage the current origin takes up (usage), and how much space is available (quota).
This method operates asynchronously, so it returns a {{jsxref("Promise")}} which resolves once the information is available. The promise's fulfillment handler is called with an object containing the usage and quota data.
estimate()
None.
A {{jsxref('Promise')}} that resolves to an object with the following properties:
quota
usage
quota. Unit is byte.usageDetails {{Non-standard_Inline}}
usage by storage system. All included properties will have a usage greater than 0 and any storage system with 0 usage will be excluded from the object.[!NOTE] The returned values are not exact: between compression, deduplication, and obfuscation for security reasons, they will be imprecise.
You may find that the quota varies from origin to origin. This variance is based on factors such as:
TypeError
In this example, we obtain the usage estimates and present the percentage of storage capacity currently used to the user.
You're currently using about <span id="percent"></span>% of your estimated
storage quota (<span id="quota"></span>).
navigator.storage.estimate().then((estimate) => {
document.getElementById("percent").textContent = (
(estimate.usage / estimate.quota) *
100
).toFixed(2);
document.getElementById("quota").textContent =
`${(estimate.quota / 1024 / 1024).toFixed(2)}MB`;
});
{{ EmbedLiveSample('Examples', 600, 40) }}
{{Specifications}}
{{Compat}}