files/en-us/web/api/workletsharedstorage/length/index.md
{{APIRef("Shared Storage API")}}{{deprecated_header}}
The length() method of the
{{domxref("WorkletSharedStorage")}} interface returns the number of entries currently stored in shared storage for the current origin.
length()
None.
A {{jsxref("Promise")}} that fulfills with a number, which represents the total count of key-value pairs currently in the shared storage.
// length() available inside a shared storage worklet module
async function retrieveLength() {
const length = await this.sharedStorage.length();
console.log(length);
}
{{Specifications}}
{{Compat}}