{"id":21492415,"url":"https://github.com/ljans/idb","last_synced_at":"2025-10-27T19:03:46.195Z","repository":{"id":163679508,"uuid":"156084836","full_name":"ljans/idb","owner":"ljans","description":"Promise-based wrapper around the IndexedDB API.","archived":false,"fork":false,"pushed_at":"2023-07-12T09:44:03.000Z","size":22,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-23T21:16:02.416Z","etag":null,"topics":["idb","indexeddb","promise","wrapper"],"latest_commit_sha":null,"homepage":"https://ljans.github.io/idb","language":"JavaScript","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/ljans.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}},"created_at":"2018-11-04T13:26:20.000Z","updated_at":"2023-07-18T09:09:12.000Z","dependencies_parsed_at":"2023-07-26T23:07:36.171Z","dependency_job_id":null,"html_url":"https://github.com/ljans/idb","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ljans%2Fidb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ljans%2Fidb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ljans%2Fidb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ljans%2Fidb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ljans","download_url":"https://codeload.github.com/ljans/idb/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244023724,"owners_count":20385312,"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":["idb","indexeddb","promise","wrapper"],"created_at":"2024-11-23T15:28:54.331Z","updated_at":"2025-10-27T19:03:46.108Z","avatar_url":"https://github.com/ljans.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# IDB\nPromise-based wrapper around the [IndexedDB](https://developer.mozilla.org/de/docs/IndexedDB) API.\n\n### Getting started\nYou would mostly want to make use of the IDB inside a [ServiceWorker](https://developers.google.com/web/fundamentals/primers/service-workers/):\n```javascript\nself.importScripts('idb.js');\n```\nOpen a new IDB connection and setup the tables you need for your project:\n```javascript\nvar idb = new IDB({\n\ttable1: {},\n\ttable2: {keyPath: 'id'},\n\ttable3: {autoIncrement: true},\n}, config);\n```\nThe following settings can be passed in the optional `config` object:\n- `name` sets the Database name (defaults to \"IDB\")\n- `version` provides the version of the table structure (defaults to 1)\n  - An increment in version triggers a database upgrade\n- `upgrade` defines a function to perform when a database upgrade was performed\n\nYou can pass the follwing options for each table:\n- `keyPath` specifies a \"primary key\" of inserted objects\n- `autoIncrement` determines, whether inserted objects get an incrementing numeric key\n\nThe defined tables will be available for operations in the newly created `idb` object like `idb.table1`. Remember that all operations return a [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise).\n\n#### Inserting data\n- `idb.\u003ctable\u003e.put({id: 'foo', a: 'b'})`\n  - Inserts the object with key \"foo\" when using `keyPath: 'id'`\n  - Inserts the object with an automatically incremented key when using `autoIncrement: true`\n- `idb.\u003ctable\u003e.put('value')`\n  - Inserts the value with an automatically incremented key when using `autoIncrement: true`\n- `idb.\u003ctable\u003e.put({id: 'foo', a: 'b'}, 'bar')`\n  - Inserts the object with key \"bar\" independent of `autoIncrement` but only without `keyPath`\n\n#### Selecting data\n- `idb.\u003ctable\u003e.get('foo')`\n  - Selects the object or value with key \"foo\" (also works with numeric keys)\n- `idb.\u003ctable\u003e.all(filter)`\n  - Applies a provided filtering function on all entries to decide which ones will be selected\n  - Example: `idb.\u003ctable\u003e.all(item =\u003e item.amount \u003e 5)`\n\n#### Deleting data\n- `idb.\u003ctable\u003e.delete('foo')`\n  - Deletes the object or value with key \"foo\" (also works with numeric keys)\n- `idb.\u003ctable\u003e.clear()`\n  - Deletes all entries in the table\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fljans%2Fidb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fljans%2Fidb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fljans%2Fidb/lists"}