{"id":27433123,"url":"https://github.com/idleberg/node-local-storage","last_synced_at":"2026-05-15T11:32:21.259Z","repository":{"id":287693676,"uuid":"965514898","full_name":"idleberg/node-local-storage","owner":"idleberg","description":"A NodeJS ponyfill for the Storage API, utilizing SQLite","archived":false,"fork":false,"pushed_at":"2026-02-17T19:26:17.000Z","size":235,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-03-13T13:52:52.508Z","etag":null,"topics":["local-storage","local-storage-api","nodejs","ponyfill","storage-api"],"latest_commit_sha":null,"homepage":"https://www.npmjs.org/package/@idleberg/local-storage","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/idleberg.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-04-13T10:35:52.000Z","updated_at":"2026-02-17T19:26:21.000Z","dependencies_parsed_at":"2026-02-01T19:02:24.385Z","dependency_job_id":null,"html_url":"https://github.com/idleberg/node-local-storage","commit_stats":null,"previous_names":["idleberg/node-local-storage"],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/idleberg/node-local-storage","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idleberg%2Fnode-local-storage","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idleberg%2Fnode-local-storage/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idleberg%2Fnode-local-storage/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idleberg%2Fnode-local-storage/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/idleberg","download_url":"https://codeload.github.com/idleberg/node-local-storage/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idleberg%2Fnode-local-storage/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33065317,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-13T13:14:54.681Z","status":"online","status_checked_at":"2026-05-15T02:00:06.351Z","response_time":103,"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":["local-storage","local-storage-api","nodejs","ponyfill","storage-api"],"created_at":"2025-04-14T17:14:13.040Z","updated_at":"2026-05-15T11:32:21.254Z","avatar_url":"https://github.com/idleberg.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @idleberg/local-storage\n\n\u003e A NodeJS ponyfill for the Storage API, utilizing SQLite.\n\n[![License](https://img.shields.io/github/license/idleberg/node-local-storage?color=blue\u0026style=for-the-badge)](https://github.com/idleberg/node-local-storage/blob/main/LICENSE)\n[![Version](https://img.shields.io/npm/v/@idleberg/local-storage?style=for-the-badge)](https://www.npmjs.org/package/@idleberg/local-storage)\n![GitHub branch check runs](https://img.shields.io/github/check-runs/idleberg/node-local-storage/main?style=for-the-badge)\n\n## Features\n\n-   zero dependencies\n-   fully API compatible to both, `localStorage` and `sessionStorage`\n-   persists data across sessions\n-   supports `storage` events\n-   supports optional quota\n\n\u003e [!NOTE]\n\u003e \n\u003e This package depends on the experimental `node:sqlite` module included in NodeJS v22.5 and later.\n\n## Installation\n\n`npm install @idleberg/local-storage`\n\n## Usage\n\n### API\n\n#### `createStorage`\n\nUsage: `createStorage(dbFile?: string, options?: StorageFactoryOptions)`  \nReturns: `{ sessionStorage, localStorage, emitter }`\n\nCreates instances of both, [`sessionStorage`][] and [`localStorage`][], as well as a corresponding EventEmitter.\n\n**Example:**\n\n```typescript\nimport { createStorage } from \"@idleberg/local-storage\";\n\nconst { sessionStorage, localStorage, emitter } = createStorage(\"./db.sqlite\");\n\n// Listen for storage changes\nemitter.on(\"storage\", console.log);\n```\n\n##### Options\n\n###### `options.quota`\n\n#### `Storage` (Advanced Usage)\n\nUsage: `new Storage(filePath: string | ':memory:', options: StorageClassOptions)`\n\nThis class is used internally by `createStorage. It allows you more control over the EventEmitter, e.g. you could re-use an existing one from your application code.\n\n**Example:**\n\n```typescript\nimport { Storage } from \"@idleberg/local-storage\";\nimport EventEmitter from \"node:events\";\n\nconst myEmitter = new EventEmitter();\n\nconst localStorage = new Storage(\"./db.sqlite\", {\n    emitter: myEmitter,\n});\n\n// Listen for storage changes\nmyEmitter.on(\"storage\", console.log);\n```\n\n##### Options\n\n###### `options.emitter`\n\nAn instance of `EventEmitter` to use for dispatching storage events.\n\n###### `options.eventName`\n\nThe name of the event to dispatch when a storage event occurs. Defaults to `storage`.\n\n###### `options.quota`\n\nOptional storage quota in bytes, useful for emulating browser behaviour.\n\n## Related\n\n-   [bun-storage](https://www.npmjs.com/package/bun-storage): a Bun implementation of this package\n\n## License\n\nThis work is licensed under [The MIT License](https://opensource.org/licenses/MIT).\n\n[`localStorage`]: https://developer.mozilla.org/docs/Web/API/Window/localStorage\n[`sessionStorage`]: https://developer.mozilla.org/docs/Web/API/Window/sessionStorage\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fidleberg%2Fnode-local-storage","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fidleberg%2Fnode-local-storage","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fidleberg%2Fnode-local-storage/lists"}