{"id":22221977,"url":"https://github.com/fabiospampinato/isostore","last_synced_at":"2025-06-28T10:35:52.594Z","repository":{"id":65895348,"uuid":"601833745","full_name":"fabiospampinato/isostore","owner":"fabiospampinato","description":"A simple isomorphic key-value store with a Map-like API for persisting data.","archived":false,"fork":false,"pushed_at":"2024-04-05T00:06:45.000Z","size":13,"stargazers_count":8,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-10T07:19:02.202Z","etag":null,"topics":["isomorphic","key","storage","store","value"],"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/fabiospampinato.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},"funding":{"github":"fabiospampinato","custom":"https://www.paypal.me/fabiospampinato"}},"created_at":"2023-02-14T23:19:53.000Z","updated_at":"2025-01-24T04:19:30.000Z","dependencies_parsed_at":null,"dependency_job_id":"f2fc2f72-b556-4da7-b27b-cb188b9cbea5","html_url":"https://github.com/fabiospampinato/isostore","commit_stats":{"total_commits":4,"total_committers":1,"mean_commits":4.0,"dds":0.0,"last_synced_commit":"059cd11e0364ad961951b490db217d3cfdf109f2"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/fabiospampinato/isostore","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabiospampinato%2Fisostore","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabiospampinato%2Fisostore/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabiospampinato%2Fisostore/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabiospampinato%2Fisostore/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fabiospampinato","download_url":"https://codeload.github.com/fabiospampinato/isostore/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabiospampinato%2Fisostore/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262417581,"owners_count":23307887,"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":["isomorphic","key","storage","store","value"],"created_at":"2024-12-02T23:16:25.347Z","updated_at":"2025-06-28T10:35:52.575Z","avatar_url":"https://github.com/fabiospampinato.png","language":"TypeScript","funding_links":["https://github.com/sponsors/fabiospampinato","https://www.paypal.me/fabiospampinato"],"categories":[],"sub_categories":[],"readme":"# IsoStore\n\nA simple isomorphic key-value store with a Map-like API for persisting data.\n\n## Features\n\n- All stores run everywhere, they just have different backends under the hood.\n- All stores are not intended for performance-critical use cases, since the entire store is saved when a change is made in it.\n- Store saves are batched automatically within a microtask, so performance is not as bad as it could be.\n- When instantiating multiple stores of the same type and with the same id you'll actually always receive the same instance back.\n- Only alphanumeric store ids are allowed, the library will throw on invalid ids.\n\n## Stores\n\nThe following stores are provided:\n\n- `AbstractStore`: A generic store with no backend, for using a custom persistence mechanism.\n- `MemoryStore`: An in-memory store, useful if you don't need persistence, but you want to use the same API.\n- `LocalStore`: A store for persisting data reliably and indefinitely.\n  - Node: it will atomically write a file to disk, in a non-temporary path that depends on your OS.\n  - Browser: it will use the `localStorage` API.\n- `SessionStore`: A store per persisting data somewhat unreliably and/or not indefinitely.\n  - Node: it will non-atomically write a temporary file to disk, which could be deleted at any time.\n  - Browser: it will use the `sessionStorage` API.\n\n## Install\n\n```sh\nnpm install --save isostore\n```\n\n## Usage\n\n```ts\nimport {AbstractStore, LocalStore, MemoryStore, SessionStore} from 'isostore';\n\n// Creating a local store, for indefinite persistence\n\nconst store = new LocalStore ( 'my-store' ); // The id of the store decides the name of the file on disk\n\nstore.has ( 'foo' ); // =\u003e false\nstore.set ( 'foo', 'some_string' ); // =\u003e store\nstore.get ( 'foo' ); // =\u003e 'some_string'\nstore.delete ( 'foo' ); // =\u003e true\n\n// Creating another local store, with the same id\n\nconst store2 = new LocalStore ( 'my-store' );\n\nconsole.log ( store === store2 ); // =\u003e true, with 🌈 magic 🌈\n\n// Creating a session store, for temporary persistence\n\nconst store3 = new SessionStore ( 'my-store' );\n\n// Creating an in-memory store, for no persistence\n\nconst store4 = new MemoryStore ();\n\n// Creating a custom store, with a custom backend\n\nconst MY_BACKEND = { // It's important to define this outside of the store class\n  read ( id ) {\n    // Return a [string, string][]\n  },\n  write ( id, entries ) {\n    // Write the entries somewhere\n  }\n};\n\nclass MyStore extends AbstractStore {\n  constructor ( id ) {\n    super ({\n      id,\n      backend: MY_BACKEND\n    });\n  }\n}\n\nconst store5 = new MyStore ( 'my-store' );\n```\n\n## License\n\nMIT © Fabio Spampinato\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffabiospampinato%2Fisostore","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffabiospampinato%2Fisostore","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffabiospampinato%2Fisostore/lists"}