Get all keys from Chrome Storage

Google ChromeGoogle Chrome-ExtensionGoogle Chrome-Storage

Google Chrome Problem Overview


I can get the value of a storage key with the Chrome Extension API:

chrome.storage.sync.get("someKey", function() {});

How can I get all key names that exist in the Chrome storage?

Google Chrome Solutions


Solution 1 - Google Chrome

From the documentation (emphasis mine):

> An empty list or object will return an empty result object. Pass in null to get the entire contents of storage. Don't forget to change "storage.sync" to storage.local if you're using local storage.

For some example code:

chrome.storage.sync.get(null, function(items) {
    var allKeys = Object.keys(items);
    console.log(allKeys);
});

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionAli EsmailianView Question on Stackoverflow
Solution 1 - Google ChromeRob WView Answer on Stackoverflow