NitroSQLite
API reference

API reference

Public exports and the connection methods in react-native-nitro-sqlite.

open() is the main entry point. It opens a named database and returns a connection whose methods no longer need the database name.

import { open } from 'react-native-nitro-sqlite'

const db = open({ name: 'app.sqlite' })
const { rows } = await db.executeAsync<{ id: number; title: string }>(
  'SELECT id, title FROM notes WHERE id = ?',
  [1],
)

console.log(rows.item(0))
db.close()
TaskConnection methodReference
Open, close, delete, attach, or detach a databaseopen, close, delete, attach, detachConnections
Run SQL and read rows or column metadataexecute, executeAsyncQueries and results
Group statementstransaction, executeBatch, executeBatchAsyncTransactions and batches
Import a SQL fileloadFile, loadFileAsyncConnections
Look up exported types and error behaviorQueryResult, NitroSQLiteError, and other typesTypes and errors
Call the underlying database-name-based hybrid objectNitroSQLite.nativeNative API

The package also exports NitroSQLite, NitroSQLiteError, typeORMDriver, and the connection, query, batch, and transaction types. Types that users receive indirectly have reference pages too: NitroSQLiteNative describes NitroSQLite.native, NitroSQLiteQueryResult describes raw results, and TypeOrmNitroSQLiteConnection describes the TypeORM adapter connection. NitroSQLite.open(options) and the named open(options) export are the same connection helper. The other top-level NitroSQLite methods are listed on the global and native API page. The typeORMDriver export is for TypeORM; vector helpers come from the separate sqlite-vec package.

Synchronous methods run on the JavaScript thread. Their async counterparts run the native work off that thread. Calls made through one opened connection are coordinated by a per-database JavaScript queue: async calls run in submission order, and a conflicting synchronous call throws a busy error.