SQLite
statement.setReadBigInts()
Selects BigInt representation for integer result columns. Avoid converting large integers to Number if precision matters; serialize explicitly at JSON boundaries. The synchronous API can block the event loop; the 22.16.0 module is experimental. This fixture uses an isolated in-memory database. Tested on Node.js 22.16.0. Example output (one line per entry): ["bigint 9007199254740993"].
Formal Syntax & Structure
nodejs syntaxnodejs
statement.setReadBigInts(enabled)Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| enabled | boolean | Enable integer BigInts. |
Return Value
undefined
Updates read behavior.
Working Example
Example Snippetnodejs
import { DatabaseSync } from 'node:sqlite';const db = new DatabaseSync(':memory:');try { const q = db.prepare('SELECT 9007199254740993 AS n'); q.setReadBigInts(true); const n = q.get().n; console.log(typeof n, n.toString());}finally { db.close();}