{"id":20879764,"url":"https://github.com/ryohidaka/chrome-storage-api","last_synced_at":"2026-02-11T05:02:02.628Z","repository":{"id":220543561,"uuid":"751103754","full_name":"ryohidaka/chrome-storage-api","owner":"ryohidaka","description":"Helper for chrome.storage API.","archived":false,"fork":false,"pushed_at":"2025-02-17T21:13:09.000Z","size":539,"stargazers_count":0,"open_issues_count":5,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-12T16:44:12.119Z","etag":null,"topics":["chrome","chromeextension","ext","extensions","storage"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/chrome-storage-api","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ryohidaka.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["ryohidaka"],"patreon":null,"open_collective":null,"ko_fi":"ryohidaka","tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"lfx_crowdfunding":null,"custom":null}},"created_at":"2024-01-31T23:44:43.000Z","updated_at":"2024-11-18T21:53:56.000Z","dependencies_parsed_at":"2024-02-05T22:32:59.906Z","dependency_job_id":"64d29bc0-2255-4c5a-b2d6-e4f3bed5c1dd","html_url":"https://github.com/ryohidaka/chrome-storage-api","commit_stats":null,"previous_names":["ryohidaka/chrome-storage-api"],"tags_count":4,"template":false,"template_full_name":"ryohidaka/npm-package-template","purl":"pkg:github/ryohidaka/chrome-storage-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryohidaka%2Fchrome-storage-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryohidaka%2Fchrome-storage-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryohidaka%2Fchrome-storage-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryohidaka%2Fchrome-storage-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ryohidaka","download_url":"https://codeload.github.com/ryohidaka/chrome-storage-api/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryohidaka%2Fchrome-storage-api/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29327093,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-11T03:52:29.695Z","status":"ssl_error","status_checked_at":"2026-02-11T03:52:23.094Z","response_time":97,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chrome","chromeextension","ext","extensions","storage"],"created_at":"2024-11-18T07:17:45.625Z","updated_at":"2026-02-11T05:02:02.612Z","avatar_url":"https://github.com/ryohidaka.png","language":"TypeScript","funding_links":["https://github.com/sponsors/ryohidaka","https://ko-fi.com/ryohidaka","https://ko-fi.com/B0B6TVH92"],"categories":[],"sub_categories":[],"readme":"# chrome-storage-api\n\n[![npm version](https://badge.fury.io/js/chrome-storage-api.svg)](https://badge.fury.io/js/chrome-storage-api)\n![build](https://github.com/ryohidaka/chrome-storage-api/workflows/Build/badge.svg)\n[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://opensource.org/licenses/MIT)\n\n[![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/B0B6TVH92)\n\n## Overview\n\nHelper for `chrome.storage` API.\n\n## Notes\n\nTo use the `chrome.storage` API, declare the `\"storage\"` permission in the [manifest](https://developer.chrome.com/docs/extensions/reference/manifest):\n\n```json\n{\n  \"name\": \"My extension\",\n\n  \"permissions\": [\"storage\"]\n}\n```\n\n## Installation\n\nYou can install this library using npm:\n\n```shell\nnpm install chrome-storage-api\n```\n\n## Usage\n\n```typescript\nimport { Storage } from \"chrome-storage-api\"\n\n// Local Storage\nStorage.Local.{get | set | push | unshift}\n\n// Sync Storage\nStorage.Sync.{get | set | push | unshift}\n\n// Managed Storage\nStorage.Managed.{get}\n\n// Session Storage\nStorage.Session.{get | set | push | unshift}\n```\n\n## Methods\n\n### `get`\n\nGets one or more items from storage.\n\n```typescript\nimport { Storage } from \"chrome-storage-api\";\n\n// Get a single item from storage.\nconst singleResult = await Storage.Local.get(\"key1\");\nconsole.log(singleResult);\n// Output: value1\n\n// Get multiple items from storage.\nconst multipleResult = await Storage.Local.get([\"key1\", \"key2\"]);\nconsole.log(multipleResult);\n// Output: [value1, value2]\n\n// Get items with default values.\nconst resultWithDefaultValue = await Storage.Local.get({\n  key4: \"value4\",\n  key5: \"value5\",\n});\nconsole.log(resultWithDefaultValue);\n// Output: { key4: \"value4\", key5: \"value5\" }\n\n// Get items using a callback function.\nStorage.Local.get(\"key1\", (items) =\u003e console.log(items));\n// Output: { key1: \"value1\" }\n```\n\n### `set`\n\nSets multiple items.\n\n```typescript\nimport { Storage } from \"chrome-storage-api\";\n\nStorage.Local.set({ key3: \"value3\" }, () =\u003e console.log(\"Value 3 was set.\"));\n```\n\n### `onChange`\n\nFired when one or more items change.\n\n```typescript\nimport { Storage } from \"chrome-storage-api\";\n\nStorage.onChange((changes, areaName) =\u003e {\n  console.log(`New Value: ${changes.key1.newValue}`);\n  console.log(`Old Value: ${changes.key1.oldValue}`);\n  console.log(`Area Name: ${areaName}`);\n});\n\n// Outputs:\n//   New Value: new value1\n//   Old Value: value1\n//   Area Name: local\n```\n\n### Only in the case of an array\n\n#### `push`\n\nPushes values to a specified key in the Chrome storage.\n\n```typescript\nimport { Storage } from \"chrome-storage-api\";\n\nawait Storage.Local.set({ key4: [\"value1\", \"value2\"] });\nawait Storage.Local.push(\"key4\", [\"value3\", \"value4\"]);\n\nStorage.Local.get(\"key4\", (items) =\u003e console.log(items));\n// Output: Array(4)[value1, value2, value3, value4]\n```\n\n#### `unshift`\n\nUnshifts values to a specified key in the Chrome storage.\n\n```typescript\nimport { Storage } from \"chrome-storage-api\";\n\nawait Storage.Local.set({ key5: [\"value3\", \"value4\"] });\nawait Storage.Local.unshift(\"key5\", [\"value1\", \"value2\"]);\n\nStorage.Local.get(\"key5\", (items) =\u003e console.log(items));\n// Output: Array(4)[value1, value2, value3, value4]\n```\n\n## Link\n\n- [chrome.storage](https://developer.chrome.com/docs/extensions/reference/api/storage)\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryohidaka%2Fchrome-storage-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fryohidaka%2Fchrome-storage-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryohidaka%2Fchrome-storage-api/lists"}