{"id":27720736,"url":"https://github.com/idleberg/bun-storage","last_synced_at":"2025-04-27T10:01:26.354Z","repository":{"id":199987138,"uuid":"704713818","full_name":"idleberg/bun-storage","owner":"idleberg","description":"A ponyfill for the Storage API, utilizing SQLite","archived":false,"fork":false,"pushed_at":"2025-04-13T06:03:46.000Z","size":93,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-13T07:19:37.458Z","etag":null,"topics":["bun","localstorage","polyfill","sessionstorage","storage-api"],"latest_commit_sha":null,"homepage":"https://www.npmjs.org/package/bun-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}},"created_at":"2023-10-13T22:24:01.000Z","updated_at":"2025-04-13T06:03:50.000Z","dependencies_parsed_at":"2025-01-24T01:19:33.833Z","dependency_job_id":"dd5f7ab0-8f3d-4593-a81b-88b4cc91403d","html_url":"https://github.com/idleberg/bun-storage","commit_stats":null,"previous_names":["idleberg/bun-storage"],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idleberg%2Fbun-storage","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idleberg%2Fbun-storage/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idleberg%2Fbun-storage/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idleberg%2Fbun-storage/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/idleberg","download_url":"https://codeload.github.com/idleberg/bun-storage/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251119576,"owners_count":21539194,"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":["bun","localstorage","polyfill","sessionstorage","storage-api"],"created_at":"2025-04-27T10:00:46.244Z","updated_at":"2025-04-27T10:01:26.259Z","avatar_url":"https://github.com/idleberg.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# bun-storage\n\n\u003e A ponyfill for the Storage API, utilizing SQLite\n\n[![License](https://img.shields.io/github/license/idleberg/bun-storage?color=blue\u0026style=for-the-badge)](https://github.com/idleberg/bun-storage/blob/main/LICENSE)\n[![Version](https://img.shields.io/npm/v/bun-storage?style=for-the-badge)](https://www.npmjs.org/package/bun-storage)\n[![Build](https://img.shields.io/github/actions/workflow/status/idleberg/bun-storage/test.yml?style=for-the-badge)](https://github.com/idleberg/bun-storage/actions)\n\n## Installation\n\n`bun install bun-storage`\n\n## Usage\n\n### API\n\n#### `createLocalStorage`\n\nUsage: `createLocalStorage(dbFile: string)`  \nReturns: `[Storage, EventEmitter]`\n\nCreates an instance of the [`localStorage`](https://developer.mozilla.org/docs/Web/API/Window/localStorage) API and a corresponding EventEmitter.\n\n**Example:**\n\n```typescript\nimport { createLocalStorage } from \"bun-storage\";\n\nconst [localStorage, emitter] = createLocalStorage(\"./db.sqlite\");\n\n// Listen for storage changes\nemitter.on(\"storage\", console.log);\n```\n\n#### `createSessionStorage`\n\nUsage: `createSessionStorage()`  \nReturns: `[Storage, EventEmitter]`\n\nCreates an instance of the [`sessionStorage`](https://developer.mozilla.org/docs/Web/API/Window/sessionStorage) API and a corresponding EventEmitter.\n\n**Example:**\n\n```typescript\nimport { createSessionStorage } from \"bun-storage\";\n\nconst [sessionStorage, emitter] = createSessionStorage();\n\n// Listen for storage changes\nemitter.on(\"storage\", console.log);\n```\n\n#### `Storage` (Advanced Usage)\n\nUsage: `new Storage(filePath: string | ':memory:', options: StorageEventOptions)`\n\nThis class is used internally by both of the above factory functions. However, instantiating the class allows you more control over the EventEmitter, i.e. you could re-use an existing one from your application code.\n\n**Example:**\n\n```typescript\nimport { Storage } from \"bun-storage\";\nimport EventEmitter from \"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## Related\n\n-   [`@idleberg/local-storage`](https://www.npmjs.com/package/@idleberg/local-storage): a NodeJS implementation of this package\n\n## License\n\nThis work is licensed under [The MIT License](https://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fidleberg%2Fbun-storage","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fidleberg%2Fbun-storage","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fidleberg%2Fbun-storage/lists"}