{"id":18684951,"url":"https://github.com/tknf/browser-storage","last_synced_at":"2025-11-07T22:30:22.534Z","repository":{"id":65526109,"uuid":"516955837","full_name":"tknf/browser-storage","owner":"tknf","description":"Browser storage with a simple, lightweight and user-friendly interface","archived":false,"fork":false,"pushed_at":"2022-07-23T04:31:30.000Z","size":30,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-01-28T06:18:29.377Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/tknf.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-07-23T04:20:31.000Z","updated_at":"2022-07-23T04:21:11.000Z","dependencies_parsed_at":"2023-01-27T08:45:16.369Z","dependency_job_id":null,"html_url":"https://github.com/tknf/browser-storage","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tknf%2Fbrowser-storage","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tknf%2Fbrowser-storage/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tknf%2Fbrowser-storage/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tknf%2Fbrowser-storage/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tknf","download_url":"https://codeload.github.com/tknf/browser-storage/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239540380,"owners_count":19655991,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2024-11-07T10:19:49.877Z","updated_at":"2025-11-07T22:30:22.502Z","avatar_url":"https://github.com/tknf.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# BrowserStorage\n\n## Browser storage with a simple, lightweight and user-friendly interface.\n\nThere are multiple options for storing information in the browser, including `cookie`, `localStorage` and `sessionStorage`.\n\nWe have created a wrapper to make them available in common interface and declaratively available based on a single key.\n\n## Usage\n\n### Installation\n\nwith NodeJS:\n```bash\nnpm install --save @tknf/browser-storage\n# or\nyarn add @tknf/browser-storage\n```\n\nin Browser:\n```html\n\u003cscript src=\"https://unpkg.com/@tknf/browser-storage@0.1.1/umd/browser-storage.min.js\"\u003e\u003c/script\u003e\n```\n\n\n### Simple example:\n```js\n// storage.js\nimport { createBrowserStorage } from \"@tknf/browser-storage\";\nconst { getStorage, saveStorage, destroyStorage } = await createBrowserStorage({\n  type: \"local\",\n  name: \"MyStorage\"\n});\n\nconst storage = await getStorage();\nstorage.set(\"one\", \"foo\");\nstorage.set(\"two\", { bar: \"baz\" });\nawait saveStorage(storage);\n\nconst one = storage.get(\"one\"); // \"foo\"\nconst two = storage.get(\"tow\"); // { bar: \"baz\" }\n```\n\n## Options\n### `type`\nSelect the type of storage to store the data from `cookie`, `local`, `session`, or `memory`.\nEach of the following storage types will be used:\n\n`cookie`  : `document.cookie`\n`local`   : `window.localStorage`\n`session` : `window.sessionStorage`\n`memory`  : `new window.Map()`\n\n### `name`\nSpecify the cookie name or storage key for storage API.\nMultiple values are held as objects in storage using single key.\n\n### `domain`, `expires`, `path`, `sameSite`, `secure`\nCookie options that can be specified only if type is cookie.\nSee [js-cookie](https://github.com/js-cookie/js-cookie) for available options.\n\n### `maxAge`\nA cookie option that can be specified only if type is cookie.\nConverts to `expires` by specifying the number of seconds until expiration.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftknf%2Fbrowser-storage","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftknf%2Fbrowser-storage","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftknf%2Fbrowser-storage/lists"}