{"id":20117800,"url":"https://github.com/sqlite-mpi/sqlite-mpi-client-js","last_synced_at":"2026-05-12T18:02:52.784Z","repository":{"id":36270657,"uuid":"222930021","full_name":"sqlite-mpi/sqlite-mpi-client-js","owner":"sqlite-mpi","description":"SQLite JavaScript client.","archived":false,"fork":false,"pushed_at":"2023-01-05T01:18:05.000Z","size":987,"stargazers_count":0,"open_issues_count":14,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-28T17:48:23.408Z","etag":null,"topics":["sqlite","sqlite3"],"latest_commit_sha":null,"homepage":"https://sqlitempi.com","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/sqlite-mpi.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}},"created_at":"2019-11-20T12:14:10.000Z","updated_at":"2019-11-23T18:03:07.000Z","dependencies_parsed_at":"2023-01-17T00:00:32.975Z","dependency_job_id":null,"html_url":"https://github.com/sqlite-mpi/sqlite-mpi-client-js","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sqlite-mpi%2Fsqlite-mpi-client-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sqlite-mpi%2Fsqlite-mpi-client-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sqlite-mpi%2Fsqlite-mpi-client-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sqlite-mpi%2Fsqlite-mpi-client-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sqlite-mpi","download_url":"https://codeload.github.com/sqlite-mpi/sqlite-mpi-client-js/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241564434,"owners_count":19982958,"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":["sqlite","sqlite3"],"created_at":"2024-11-13T19:07:50.179Z","updated_at":"2026-05-12T18:02:47.761Z","avatar_url":"https://github.com/sqlite-mpi.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"SQLite client for JavaScript.\n\nSee [sqlitempi.com](https://sqlitempi.com) for a general overview.\n\n### Install\n\n- `yarn add sqlite-mpi-client-js`\n    - Or: `npm install --save sqlite-mpi-client-js`\n\n\n### IO Providers\n\nYou also need to install an IO provider.\n\n- [React Native](https://github.com/sqlite-mpi/smpi-iop-react-native) \n- [Node.js](https://github.com/sqlite-mpi/smpi-iop-node-ffi)\n\n### Usage\n\nSee `./test/all` for detailed usage.\n\n\n#### Get a file ref\n```javascript\n// Note: Example is for Node.js.\nconst {smpi} = require(\"sqlite-mpi-client-js\");\nconst iop = require(\"smpi-iop-node-ffi\");\n\nconst c = smpi.newClient(iop);\nconst f = c.newFileRef(\"/tmp/db-file.sqlite\");\n```\n\n#### Write transactions\n\n- There is only one active write transaction at a time per SQLite file.\n    - This applies at an OS level, for all processes.\n\n- Write tx requests will queue when there is an active outstanding write tx.\n    - Queued write tx requests will resolve in First In First Out (FIFO) manner.\n    - When the promise returned from `f.getWriteTx()` resolves, the `wtx` is active.\n\n\n```javascript\nconst wtx = await f.getWriteTx();\n\n// `q` can be a read or write with write txs.\nawait wtx.q(\"SELECT 1+1\");\n\nawait wtx.read(\"SELECT 1+1\");\n\nawait wtx.write(\"INSERT ...\");\n\nawait wtx.commit();\n// await wtx.rollback();\n```\n\n#### Read transactions\n\n- Read transactions are concurrent; you can have many read transactions active and reading from the same database file.\n\n```javascript\nconst rtx = await f.getReadTx();\n\n// `q` must be a read.\nawait rtx.q(\"SELECT 1+1\");\n\nawait rtx.read(\"SELECT 1+1\");\n\n// No writes.\n// await tx.write(\"INSERT ...\");\n\nawait rtx.commit();\n// await rtx.rollback();\n```\n\n\n\n#### Params\n\n\n```javascript\nconst wtx = await f.getWriteTx();\n\n// Index based.\nawait wtx.write(\"INSERT INTO t1 (b) VALUES (?), (?)\", [1, 2]);\nawait wtx.write(\"INSERT INTO t1 (b) VALUES (?1), (?2)\", [3, 4]);\n\n// Key based.\nawait wtx.write(\"INSERT INTO t1 (b) VALUES (:x), (:y)\", {x: 1, y: 2});\nawait wtx.write(\"INSERT INTO t1 (b) VALUES (@x), (@y)\", {x: 1, y: 2});\nawait wtx.commit();\n```\n\n### Notes\n\n- SQLite `WAL` mode is always on; you can not turn it off.\n- Reads are concurrent, writes queue.\n\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsqlite-mpi%2Fsqlite-mpi-client-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsqlite-mpi%2Fsqlite-mpi-client-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsqlite-mpi%2Fsqlite-mpi-client-js/lists"}