{"id":20513758,"url":"https://github.com/webreflection/sqlite-tag-spawned","last_synced_at":"2025-07-03T14:07:40.781Z","repository":{"id":57368337,"uuid":"448239258","full_name":"WebReflection/sqlite-tag-spawned","owner":"WebReflection","description":"Same as sqlite-tag but without the native sqlite3 module dependency","archived":false,"fork":false,"pushed_at":"2025-02-21T14:46:58.000Z","size":237,"stargazers_count":19,"open_issues_count":0,"forks_count":4,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-21T08:51:05.541Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/WebReflection.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":"2022-01-15T09:54:57.000Z","updated_at":"2025-02-21T14:47:00.000Z","dependencies_parsed_at":"2025-04-14T00:01:01.875Z","dependency_job_id":"31301fb1-ce89-4fcc-a37a-3f6519a90ded","html_url":"https://github.com/WebReflection/sqlite-tag-spawned","commit_stats":null,"previous_names":[],"tags_count":24,"template":false,"template_full_name":null,"purl":"pkg:github/WebReflection/sqlite-tag-spawned","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WebReflection%2Fsqlite-tag-spawned","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WebReflection%2Fsqlite-tag-spawned/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WebReflection%2Fsqlite-tag-spawned/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WebReflection%2Fsqlite-tag-spawned/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/WebReflection","download_url":"https://codeload.github.com/WebReflection/sqlite-tag-spawned/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WebReflection%2Fsqlite-tag-spawned/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262035214,"owners_count":23248361,"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":[],"created_at":"2024-11-15T21:13:01.059Z","updated_at":"2025-06-26T09:09:47.731Z","avatar_url":"https://github.com/WebReflection.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# sqlite-tag-spawned\n\n[![build status](https://github.com/WebReflection/sqlite-tag-spawned/actions/workflows/node.js.yml/badge.svg)](https://github.com/WebReflection/sqlite-tag-spawned/actions) [![Coverage Status](https://coveralls.io/repos/github/WebReflection/sqlite-tag-spawned/badge.svg?branch=main)](https://coveralls.io/github/WebReflection/sqlite-tag-spawned?branch=main)\n\n\u003csup\u003e**Social Media Photo by [Tomas Kirvėla](https://unsplash.com/@tomkirvela) on [Unsplash](https://unsplash.com/)**\u003c/sup\u003e\n\n\nThe same [sqlite-tag](https://github.com/WebReflection/sqlite-tag#readme) ease but without the native [sqlite3](https://www.npmjs.com/package/sqlite3) dependency, aiming to replace [dblite](https://github.com/WebReflection/dblite#readme).\n\n```js\nimport SQLiteTagSpawned from 'sqlite-tag-spawned';\n// const SQLiteTagSpawned = require('sqlite-tag-spawned');\n\nconst {query, get, all, raw, transaction} = SQLiteTagSpawned('./db.sql');\n\n// single query as any info\nconsole.log(await query`.databases`);\n\n// single query as SQL\nawait query`CREATE TABLE IF NOT EXISTS names (\n  id INTEGER PRIMARY KEY,\n  name TEXT\n)`;\n\n// transaction (requires .commit() to execute)\nconst populate = transaction();\nfor (let i = 0; i \u003c 2; i++)\n  populate`INSERT INTO names (name) VALUES (${'Name' + i})`;\nawait populate.commit();\n\n// get single row (works with LIMIT 1 too, of course)\nawait get`SELECT name FROM names`;\n// { name: 'Name0' }\n\n// get all results, if any, or an empty array\nawait all`SELECT * FROM names`;\n// [ { id: 1, name: 'Name0' }, { id: 2, name: 'Name1' } ]\n\n// use the IN clause through arrays\nconst list = ['Name 0', 'Name 1'];\nawait all`SELECT * FROM names WHERE name IN (${list})`;\n```\n\n\n### Differently from dblite\n\n  * requires **SQLite 3.33** or higher (it uses the `-json` output mode)\n  * each query is a spawn call except for transactions, grouped as single spawned query\n  * performance still similar to sqlite3 native module\n  * `:memory:` database is based on an always same, yet runtime-once created temporary file, and it requires NodeJS 16+\n\n\n## API: SQLiteTagSpawned(fileName[, options])\n\nWhile the `fileName` is just a string pointing at the db file or the string `:memory:`, optional options can contain the following fields:\n\n  * `readonly` to run queries in read only mode\n  * `bin` to specify a different `sqlite3` executable\n  * `timeout` to drop the spawned process after *N* milliseconds\n  * `persistent` to open a DB in persistent mode (kept alive spawned command)\n  * `exec` to specify a different way to execute spawned process and results, mostly used for internal purpose\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebreflection%2Fsqlite-tag-spawned","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwebreflection%2Fsqlite-tag-spawned","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebreflection%2Fsqlite-tag-spawned/lists"}