{"_id":"@bitfinex/bfx-facs-db-better-sqlite","_rev":"2-ca8d58bcb1acf4641d83502ed510a6ae","name":"@bitfinex/bfx-facs-db-better-sqlite","dist-tags":{"latest":"3.0.0"},"versions":{"2.1.0":{"name":"@bitfinex/bfx-facs-db-better-sqlite","version":"2.1.0","keywords":["bitfinex"],"author":{"name":"Vladimir Voronkov","email":"vsvoronkov@gmail.com"},"license":"Apache-2.0","_id":"@bitfinex/bfx-facs-db-better-sqlite@2.1.0","maintainers":[{"name":"vigan-abd","email":"vigan.abd@gmail.com"},{"name":"bitfinexorg","email":"paolo@bitfinex.com"},{"name":"prdn","email":"paolo.ardoino@gmail.com"},{"name":"mafintosh","email":"mathiasbuus@gmail.com"}],"contributors":[{"name":"Paolo Ardoino","email":"paolo@bitfinex.com"},{"name":"Ezequiel Wernicke","email":"ezequiel.wernicke@bitfinex.com"},{"name":"Vladimir Voronkov","email":"vsvoronkov@gmail.com"}],"dist":{"shasum":"7b16b008cf4191a7623b5bdcaa43bf3cf9a47478","tarball":"https://registry.npmjs.org/@bitfinex/bfx-facs-db-better-sqlite/-/bfx-facs-db-better-sqlite-2.1.0.tgz","fileCount":29,"integrity":"sha512-hcGEt4GmiLTWpJPXNp0ICnUF1cnKHBUokUHIAE9OVZudh5XP6kJ7xHAX7a33+WSQVenk/b6RSXxMlIkhGEAOUA==","signatures":[{"sig":"MEQCIBa8tEqEv9gowObMIVqy4CyGCs63PC25lfanTWOa/cmnAiBAWf6+RDNuNIumIf511HkfY1wkNltMa3os0M6YqmwFnQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":53819},"main":"index.js","engines":{"node":">=20.18.1"},"gitHead":"a7c37ffcb2f06c2e5c661da6ae8eb562456b6cbf","scripts":{"lint":"standard --env mocha","test":"npm run lint && npm run unit","unit":"mocha './test/**/*.spec.js' --config .mocharc.json"},"_npmUser":{"name":"vigan-abd","email":"vigan.abd@gmail.com"},"standard":{"globals":["describe","it","before","after","beforeEach","afterEach"]},"_npmVersion":"10.7.0","description":"Bitfinex DB Sqlite3 Facility","directories":{},"_nodeVersion":"18.20.4","dependencies":{"async":"3.2.4","better-sqlite3":"12.4.1","@bitfinex/bfx-facs-base":"git+https://github.com/bitfinexcom/bfx-facs-base.git"},"_hasShrinkwrap":false,"devDependencies":{"chai":"^4.5.0","mocha":"^11.1.0","chai-fs":"^2.0.0","standard":"^17.1.2"},"_npmOperationalInternal":{"tmp":"tmp/bfx-facs-db-better-sqlite_2.1.0_1770754565480_0.6741045932829544","host":"s3://npm-registry-packages-npm-production"}},"3.0.0":{"name":"@bitfinex/bfx-facs-db-better-sqlite","version":"3.0.0","description":"Bitfinex DB Sqlite3 Facility","author":{"name":"Vladimir Voronkov","email":"vsvoronkov@gmail.com"},"main":"index.js","keywords":["bitfinex"],"scripts":{"test":"npm run lint && npm run unit","unit":"mocha './test/**/*.spec.js' --config .mocharc.json","lint":"standard --env mocha"},"dependencies":{"@bitfinex/bfx-facs-base":"git+https://github.com/bitfinexcom/bfx-facs-base.git","async":"3.2.4","better-sqlite3":"13.0.1"},"engines":{"node":">=22"},"license":"Apache-2.0","contributors":[{"name":"Paolo Ardoino","email":"paolo@bitfinex.com"},{"name":"Ezequiel Wernicke","email":"ezequiel.wernicke@bitfinex.com"},{"name":"Vladimir Voronkov","email":"vsvoronkov@gmail.com"}],"devDependencies":{"chai":"^6.2.2","mocha":"^11.7.5","standard":"^17.1.2"},"standard":{"globals":["describe","it","before","after","beforeEach","afterEach"]},"gitHead":"1909d26a936fafd1f61565df6dc98d3802396d1a","_id":"@bitfinex/bfx-facs-db-better-sqlite@3.0.0","_nodeVersion":"24.15.0","_npmVersion":"11.12.1","dist":{"integrity":"sha512-1rxZpiZGT4WoRVdaI8ltX6T9jHJH4zXQz02KcRM4gZbQ8IwF3MsJcA11t2JdemiKIhjAXr4yjJTl5SpzDqb5Ww==","shasum":"544d253ac9de5486410547b42908133b3aca5c84","tarball":"https://registry.npmjs.org/@bitfinex/bfx-facs-db-better-sqlite/-/bfx-facs-db-better-sqlite-3.0.0.tgz","fileCount":29,"unpackedSize":53660,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIDKTqj1WMwfFBqpS8TGNkhMWLpKExEfYvFYAyrpjXPYeAiAQq70x17oKKxphyiH4TGjfR/RwmoE79OB+dIg3Fpno5A=="}]},"_npmUser":{"name":"vigan-abd","email":"vigan.abd@gmail.com"},"directories":{},"maintainers":[{"name":"vigan-abd","email":"vigan.abd@gmail.com"},{"name":"bitfinexorg","email":"paolo@bitfinex.com"},{"name":"prdn","email":"paolo.ardoino@gmail.com"},{"name":"mafintosh","email":"mathiasbuus@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/bfx-facs-db-better-sqlite_3.0.0_1784892199906_0.43676906531958526"},"_hasShrinkwrap":false}},"time":{"created":"2026-02-10T20:16:05.355Z","modified":"2026-07-24T11:23:20.221Z","2.1.0":"2026-02-10T20:16:05.622Z","3.0.0":"2026-07-24T11:23:20.042Z"},"author":{"name":"Vladimir Voronkov","email":"vsvoronkov@gmail.com"},"license":"Apache-2.0","keywords":["bitfinex"],"description":"Bitfinex DB Sqlite3 Facility","contributors":[{"name":"Paolo Ardoino","email":"paolo@bitfinex.com"},{"name":"Ezequiel Wernicke","email":"ezequiel.wernicke@bitfinex.com"},{"name":"Vladimir Voronkov","email":"vsvoronkov@gmail.com"}],"maintainers":[{"name":"vigan-abd","email":"vigan.abd@gmail.com"},{"name":"bitfinexorg","email":"paolo@bitfinex.com"},{"name":"prdn","email":"paolo.ardoino@gmail.com"},{"name":"mafintosh","email":"mathiasbuus@gmail.com"}],"readme":"# bfx-facs-db-better-sqlite\n\n## Config\n\nAvailable the following config options:\n\n```js\n{\n  name,\n  label,\n  dbPathAbsolute,\n  isSqliteStoredInMemory = false,\n  workerPathAbsolute,\n  isNotWorkerSpawned = false,\n  minWorkersCount = 4,\n  maxWorkersCount = 16,\n  unacceptableWalFileSize = 100000000,\n  readonly = false,\n  fileMustExist = false,\n  timeout = 5000,\n  verbose = false\n}\n```\n\n- `name`: \\<string\\> used to construct the database name: \\``db-sqlite${name}${label}.db`\\`\n\n- `label`: \\<string\\> used to construct the database name: \\``db-sqlite${name}${label}.db`\\`\n\n- `dbPathAbsolute`: \\<string\\> absolute path to specify a folder for storing DB files\n\n- `isSqliteStoredInMemory` (by default `false`): \\<boolean\\> store DB in memory [in-memory database](https://www.sqlite.org/inmemorydb.html), passing `\":memory:\"` as the first argument into the [database options](https://github.com/JoshuaWise/better-sqlite3/blob/master/docs/api.md#new-databasepath-options)\n\n- `workerPathAbsolute`: \\<string\\> absolute path to specify a worker file for extending DB async query actions, see base implementation in the [./worker](worker) folder and extended implementation in the [./test/extended-worker](test/extended-worker) folder\n\n- `isNotWorkerSpawned` (by default `false`): \\<boolean\\> not spawn worker threads for async queries\n\n- `minWorkersCount` (by default `4`): \\<integer\\> count spawned workers are equal CPU cores count but not less than this value. If set `0` one worker will be spawned anyway\n\n- `maxWorkersCount` (by default `16`): \\<integer\\> count spawned workers are equal CPU cores count but not more than this value\n\n- `unacceptableWalFileSize` (by default `100000000`): \\<integer\\> unacceptable WAL file size in bytes, when the WAL file gets more than passed value `PRAGMA wal_checkpoint(RESTART)` will be executed related to [checkpoint starvation](https://github.com/JoshuaWise/better-sqlite3/blob/master/docs/performance.md#checkpoint-starvation)\n\n- `readonly` (by default `false`): \\<boolean\\> open the database connection in readonly mode passing as the second argument into the [database options](https://github.com/JoshuaWise/better-sqlite3/blob/master/docs/api.md#new-databasepath-options)\n\n- `fileMustExist` (by default `false`): \\<boolean\\> if the database does not exist, an Error will be thrown instead of creating a new file. This option does not affect in-memory or readonly database connections, passing as the second argument into the [database options](https://github.com/JoshuaWise/better-sqlite3/blob/master/docs/api.md#new-databasepath-options)\n\n- `timeout` (by default `5000`): \\<integer\\> the number of milliseconds to wait when executing queries on a locked database, before throwing a SQLITE_BUSY error passing as the second argument into the [database options](https://github.com/JoshuaWise/better-sqlite3/blob/master/docs/api.md#new-databasepath-options)\n\n- `verbose` (by default `false`): \\<boolean\\> if `true` the `console.log` will called with every SQL string executed by the database connection, passing `console.log` as the second argument into the [database options](https://github.com/JoshuaWise/better-sqlite3/blob/master/docs/api.md#new-databasepath-options)\n\n## API\n\n[Sqlite](index.js) class provides the following methods:\n\n- `.asyncQuery(args)`: provides an async way to delegate a query into DB using implemented worker [actions](worker/db-worker-actions/index.js) or extended worker [actions](test/extended-worker/db-worker-actions/index.js). For that uses Node.js [worker threads](https://nodejs.org/api/worker_threads.html)\n\n  **Parameters**:\n\n  - `args`: \\<Object\\>\n    - `action` (required): \\<string\\> action that needs to pick to process logic\n    - `sql`: \\<string | Array[string]\\> SQL that needs to execute by the DB driver via worker\n    - `params`: \\<any\\> parameters that pass into worker action\n\n  **Returns**:\n\n  - \\<Promise\\> contains returning action result\n\n- `.initializeWalCheckpointRestart(ms)`: checks WAL file size in bytes which setting in `unacceptableWalFileSize` config option, by set interval, when the WAL file gets more than passed value `PRAGMA wal_checkpoint(RESTART)` will be executed related to [checkpoint starvation](https://github.com/JoshuaWise/better-sqlite3/blob/master/docs/performance.md#checkpoint-starvation)\n\n  **Parameters**:\n\n  - `ms` (by default 10000): \\<integer\\> interval in milliseconds with which the WAL file size will be checked\n","readmeFilename":"README.md"}