{"id":16542506,"url":"https://github.com/tada5hi/browser-storage-adapter","last_synced_at":"2026-06-09T05:05:29.072Z","repository":{"id":36987655,"uuid":"440776771","full_name":"tada5hi/browser-storage-adapter","owner":"tada5hi","description":"This is a library to save key-value pairs simultaneously to one or multiple storages (e.g. SessionStorage, LocalStorage, Cookie, ...).","archived":false,"fork":false,"pushed_at":"2023-05-19T01:01:07.000Z","size":1095,"stargazers_count":0,"open_issues_count":5,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-09-21T21:00:43.809Z","etag":null,"topics":["browser","cookie","localstorage","sessionstorage","simultaneously"],"latest_commit_sha":null,"homepage":"","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/tada5hi.png","metadata":{"files":{"readme":"README.MD","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-12-22T07:49:08.000Z","updated_at":"2023-03-17T12:49:43.000Z","dependencies_parsed_at":"2024-06-21T04:20:56.263Z","dependency_job_id":"fe7de128-2a20-45d7-979b-d7b4b9ddc594","html_url":"https://github.com/tada5hi/browser-storage-adapter","commit_stats":{"total_commits":113,"total_committers":3,"mean_commits":"37.666666666666664","dds":"0.23893805309734517","last_synced_commit":"72d77940fae17ae486034bd8b391ae6fa739f403"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/tada5hi/browser-storage-adapter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tada5hi%2Fbrowser-storage-adapter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tada5hi%2Fbrowser-storage-adapter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tada5hi%2Fbrowser-storage-adapter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tada5hi%2Fbrowser-storage-adapter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tada5hi","download_url":"https://codeload.github.com/tada5hi/browser-storage-adapter/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tada5hi%2Fbrowser-storage-adapter/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34092319,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-09T02:00:06.510Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["browser","cookie","localstorage","sessionstorage","simultaneously"],"created_at":"2024-10-11T18:57:44.969Z","updated_at":"2026-06-09T05:05:29.040Z","avatar_url":"https://github.com/tada5hi.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Browser Storage Adapter 💾\n\n[![npm version](https://badge.fury.io/js/browser-storage-adapter.svg)](https://badge.fury.io/js/browser-storage-adapter)\n[![CI](https://github.com/tada5hi/browser-storage-adapter/actions/workflows/main.yml/badge.svg)](https://github.com/tada5hi/browser-storage-adapter/actions/workflows/main.yml)\n[![Known Vulnerabilities](https://snyk.io/test/github/Tada5hi/browser-storage-adapter/badge.svg?targetFile=package.json)](https://snyk.io/test/github/Tada5hi/browser-storage-adapter?targetFile=package.json)\n[![semantic-release: angular](https://img.shields.io/badge/semantic--release-angular-e10079?logo=semantic-release)](https://github.com/semantic-release/semantic-release)\n\n\nThis is a library to save key-value pairs to one or multiple storages (e.g. SessionStorage, LocalStorage, Cookie, ...).\n\n**Table of Contents**\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Options](#options)\n\n## Installation\n\n```bash\nnpm install browser-storage-adapter --save\n```\n\n## Usage\n\nCreate an instance of the `Adapter` and specify the `driver`s,\nwhich should be enabled. By default, all drivers are disabled, expect of the in-memory driver, which is always enabled.\n\nBesides, it is also possible to specify a custom `namespace`, so different instances of the Adapter don't interfere with each other, when they use the same key.\n\n```typescript\nimport { Adapter } from 'browser-storage-adapter';\n\nconst warehouse = new Adapter({\n    driver: {\n        cookie: {\n            path: '/',\n        },\n        localStorage: true,\n        sessionStorage: true,\n    },\n    namespace: 'auth'\n});\n\n// Set a key-value pair for the following drivers:\n// cookie, localStorage \u0026 sessionStorage.\nwarehouse.set('token', 'xxx');\n\n// Ensure that value is still the same for all drivers.\nwarehouse.sync('token', 'xxx');\n\n// Get a key-value pair.\nconst token = warehouse.get('token');\nconsole.log(token);\n// xxx\n```\n\n## Options\n\nThe Adapter accepts an `OptionsInput` object as input parameter, to modify the default behaviour.\n\n````typescript\nimport { CookieSerializeOptions } from 'cookie';\n\ndeclare type OptionsInput = {\n    /**\n     * Specify a key prefix.\n     * e.g.\n     *  namespace: auth\n     *  key: token\n     *  keyWithNamespace: auth_token\n     */\n    namespace?: string,\n    /**\n     * Enable or disable some available drivers.\n     */\n    driver?: {\n        localStorage?: boolean,\n        sessionStorage?: boolean,\n        cookie?: boolean | CookieSerializeOptions\n    },\n    /**\n     * Check if the application is server rendered.\n     */\n    isServer?: () =\u003e boolean,\n\n    /**\n     * Set cookie.\n     *\n     * @param key\n     * @param value\n     */\n    setCookie?: (key: string, value: unknown) =\u003e void,\n\n    /**\n     * Get cookie.\n     *\n     * @param key\n     */\n    getCookie?: (key: string) =\u003e unknown,\n\n    /**\n     * Append serialized cookie.\n     *\n     * @param value\n     */\n    setServerCookie?: (value: string) =\u003e void,\n    /**\n     * Ger serialized cookie(s).\n     */\n    getServerCookies?: () =\u003e string\n}\n````\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftada5hi%2Fbrowser-storage-adapter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftada5hi%2Fbrowser-storage-adapter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftada5hi%2Fbrowser-storage-adapter/lists"}