{"id":22222052,"url":"https://github.com/fabiospampinato/bustore","last_synced_at":"2025-07-27T16:32:28.391Z","repository":{"id":193371517,"uuid":"688698022","full_name":"fabiospampinato/bustore","owner":"fabiospampinato","description":"An isomorphic asynchronous Map-inspired key-value store for persisting blobs.","archived":false,"fork":false,"pushed_at":"2023-09-24T16:28:47.000Z","size":16,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-14T13:05:51.009Z","etag":null,"topics":["binary","isomorphic","key","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}},"created_at":"2023-09-07T23:11:23.000Z","updated_at":"2023-12-11T16:12:01.000Z","dependencies_parsed_at":"2023-09-08T00:08:11.864Z","dependency_job_id":null,"html_url":"https://github.com/fabiospampinato/bustore","commit_stats":null,"previous_names":["fabiospampinato/bustore","fabiospampinato/binstore"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabiospampinato%2Fbustore","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabiospampinato%2Fbustore/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabiospampinato%2Fbustore/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabiospampinato%2Fbustore/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fabiospampinato","download_url":"https://codeload.github.com/fabiospampinato/bustore/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227817017,"owners_count":17824200,"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":["binary","isomorphic","key","store","value"],"created_at":"2024-12-02T23:16:42.321Z","updated_at":"2024-12-02T23:16:43.023Z","avatar_url":"https://github.com/fabiospampinato.png","language":"TypeScript","readme":"# Bustore\n\nAn isomorphic asynchronous Map-inspired key-value store for persisting blobs.\n\n## Install\n\n```sh\nnpm install --save bustore\n```\n\n## Usage\n\nThe following providers are built-in:\n\n```ts\nimport ProviderAbstract from 'bustore/abstract'; // The most basic abstract provider\nimport ProviderAbstractFS from 'bustore/abstract-fs'; // The most basic abstract filesystem provider\nimport ProviderMemory from 'bustore/memory'; // A provider that reads/writes to memory\nimport ProviderFS from 'bustore/fs'; // A provider that reads/writes to the filesystem\nimport ProviderIndexedDB from 'bustore/indexeddb'; // A provider that reads/writes to IndexedDB\nimport ProviderMulti from 'bustore/multi'; // A higher-order provider that can read from multiple other providers\n```\n\nThis is how you'd use providers:\n\n```ts\nimport ProviderMemory from 'bustore/memory';\nimport ProviderFS from 'bustore/fs';\nimport ProviderIndexedDB from 'bustore/indexeddb';\nimport ProviderMulti from 'bustore/multi';\n\n// Let's create and manipulate a memory store\n// Memory and IndexedDB stores also support optionally storing metadata along witht the blob\n\ntype Metadata = {\n  something: number\n};\n\nconst memory = new ProviderMemory\u003cMetadata\u003e ({\n  id: 'my-store'\n});\n\nmemory.has ( 'foo' ); // =\u003e Promise\u003cboolean\u003e\n\nmemory.set ( 'foo', 'some content' ); // =\u003e Promise\u003cvoid\u003e\nmemory.set ( 'foo', 'some content', { something: 123 } ); // =\u003e Promise\u003cvoid\u003e\nmemory.set ( 'bar', new Uint8Array ([ 0, 1, 2, 3 ]), { something: 321 } ); // =\u003e Promise\u003cvoid\u003e\n\nmemory.get ( 'foo' ); // =\u003e { content: Uint8Array | string, metadata?: Metadata }\nmemory.get ( 'foo', 'buffer' ); // =\u003e { content: Uint8Array, metadata?: Metadata }\nmemory.get ( 'foo', 'utf8' ); // =\u003e { content: string, metadata?: Metadata }\n\nmemory.delete ( 'foo' ); // =\u003e Promise\u003cboolean\u003e\n\nmemory.keys (); // =\u003e Promise\u003cstring[]\u003e\nmemory.values (); // =\u003e Promise\u003c{ content: Uint8Array | string, metadata?: Metadata }[]\u003e\nmemory.entries (); // =\u003e Promise\u003c[string, { content: Uint8Array | string, metadata?: Metadata }][]\u003e\n\n// Let's create an IndexedDB store\n// It has the same exact API as the memory one\n\nconst idb = new IndexedDB\u003cMetadata\u003e ({\n  id: 'my-store'\n});\n\n// Let's create a filesystem store\n// The only difference with the others is that it doesn't support storing metadata alongside the blob\n\nconst fs = new ProviderFS ({\n  id: 'my-store',\n  path: '/path/to/store'\n});\n\n// Let's create a multi store\n// It can read from multiple store, and it can write to one of them\n// It doesn't support iteration APIs, since for example computing entries with multiple backends would be confusing\n\nconst backend1 = new ProviderMemory ();\nconst backend2 = new ProviderFS ({ path: '/path/to/store' });\n\nconst multi = new ProviderMulti ({\n  id: 'my-store',\n  read: [backend1, backend2],\n  write: backend2\n});\n```\n\n## License\n\nMIT © Fabio Spampinato\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffabiospampinato%2Fbustore","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffabiospampinato%2Fbustore","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffabiospampinato%2Fbustore/lists"}