# zidane/durable/node-sqlite

> A SQLite driver for the durable kernel on Node, through node:sqlite.

Import: `import { … } from 'zidane/durable/node-sqlite'`. Source: [src/durable/storage/sqlite-node.ts](https://github.com/Tahul/zidane/blob/main/src/durable/storage/sqlite-node.ts).

Use `nodeSqliteDriver` to keep durable records in a SQLite file on Node. Pass the driver to `sqliteStorage` from [`zidane/durable`](https://zidane.si/docs/reference/durable.md), then open the kernel on that storage. It takes a path, `:memory:`, or an open `DatabaseSync`. With a path, the driver creates a missing file and closes the connection itself. With an open `DatabaseSync`, you close it. It sets WAL with `synchronous = FULL` on the connection. It needs a Node version with `node:sqlite`. On Bun, use `bunSqliteDriver` from [`zidane/durable/sqlite`](https://zidane.si/docs/reference/durable-sqlite.md). See [durable tasks and hosts](https://zidane.si/docs/durable-kernel.md).

```ts
import { openDurable, sqliteStorage } from 'zidane/durable'
import { nodeSqliteDriver } from 'zidane/durable/node-sqlite'

const storage = sqliteStorage(nodeSqliteDriver('./durable.db'))
const durable = await openDurable({ storage })
await durable.resumeLive()
```

## Functions

### `nodeSqliteDriver`

Function.

A driver over the SQLite file at `target`, or over an open `DatabaseSync`.
With a path, the driver creates the file when it is missing, and it closes
the connection it opened. With an open database, the caller closes it.
Either way it sets the file pragmas (`applyFilePragmas`) on the connection.

```ts
function nodeSqliteDriver(target: string | DatabaseSync): SqliteDriver
```

**Parameters**

- `target` (`string | DatabaseSync`): A path, `:memory:`, or an open database.

**Returns** `SqliteDriver`

Source: [src/durable/storage/sqlite-node.ts:15](https://github.com/Tahul/zidane/blob/main/src/durable/storage/sqlite-node.ts#L15)
