
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
chrome-storage-api
Advanced tools
Helper for chrome.storage API.
To use the chrome.storage API, declare the "storage" permission in the manifest:
{
"name": "My extension",
"permissions": ["storage"]
}
You can install this library using npm:
npm install chrome-storage-api
import { Storage } from "chrome-storage-api"
// Local Storage
Storage.Local.{get | set | push | unshift}
// Sync Storage
Storage.Sync.{get | set | push | unshift}
// Managed Storage
Storage.Managed.{get}
// Session Storage
Storage.Session.{get | set | push | unshift}
getGets one or more items from storage.
import { Storage } from "chrome-storage-api";
// Get a single item from storage.
const singleResult = await Storage.Local.get("key1");
console.log(singleResult);
// Output: value1
// Get multiple items from storage.
const multipleResult = await Storage.Local.get(["key1", "key2"]);
console.log(multipleResult);
// Output: [value1, value2]
// Get items with default values.
const resultWithDefaultValue = await Storage.Local.get({
key4: "value4",
key5: "value5",
});
console.log(resultWithDefaultValue);
// Output: { key4: "value4", key5: "value5" }
// Get items using a callback function.
Storage.Local.get("key1", (items) => console.log(items));
// Output: { key1: "value1" }
setSets multiple items.
import { Storage } from "chrome-storage-api";
Storage.Local.set({ key3: "value3" }, () => console.log("Value 3 was set."));
onChangeFired when one or more items change.
import { Storage } from "chrome-storage-api";
Storage.onChange((changes, areaName) => {
console.log(`New Value: ${changes.key1.newValue}`);
console.log(`Old Value: ${changes.key1.oldValue}`);
console.log(`Area Name: ${areaName}`);
});
// Outputs:
// New Value: new value1
// Old Value: value1
// Area Name: local
pushPushes values to a specified key in the Chrome storage.
import { Storage } from "chrome-storage-api";
await Storage.Local.set({ key4: ["value1", "value2"] });
await Storage.Local.push("key4", ["value3", "value4"]);
Storage.Local.get("key4", (items) => console.log(items));
// Output: Array(4)[value1, value2, value3, value4]
unshiftUnshifts values to a specified key in the Chrome storage.
import { Storage } from "chrome-storage-api";
await Storage.Local.set({ key5: ["value3", "value4"] });
await Storage.Local.unshift("key5", ["value1", "value2"]);
Storage.Local.get("key5", (items) => console.log(items));
// Output: Array(4)[value1, value2, value3, value4]
This project is licensed under the MIT License - see the LICENSE file for details.
FAQs
Helper for chrome.storage API.
The npm package chrome-storage-api receives a total of 1 weekly downloads. As such, chrome-storage-api popularity was classified as not popular.
We found that chrome-storage-api demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.