npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@pilaniaanand/driver-sqlite

v0.6.0

Published

Readme

@pilaniaanand/driver-sqlite

SQLite driver for db-viewer, implementing DatabaseDriver from @pilaniaanand/driver-interface on top of better-sqlite3.

Install

npm install @pilaniaanand/driver-sqlite

(Or via db-viewer's own driver manager: db-viewer driver add sqlite.) Requires a native binding — better-sqlite3 compiles on install, which needs a C++ toolchain unless a prebuilt binary is available for your platform/Node version.

Connecting

File-based — just filePath (or :memory:). No host/port/credentials/TLS. readOnly: true blocks every write through this connection at the server layer, independent of the file's own OS permissions.

The database is opened in WAL mode (journal_mode = WAL) for better concurrent read performance.

What this driver supports

  • Single-column keyset pagination (WHERE pk > ?, never OFFSET); falls back to SQLite's own rowid when a table has no declared primary key.
  • MAX(rowid) as a fast row-count estimate (SQLite has no built-in statistics table); exact counts do a real COUNT(*).
  • Streaming query results via better-sqlite3's .iterate(), so large results and CSV/NDJSON export never buffer in memory.
  • Live updates via poll-and-diff. SQLite's own change-notification mechanism (update_hook) is per-connection and in-process only — it can't see writes from another connection or process touching the same file, so it wouldn't catch anything but db-viewer's own writes anyway. Instead this driver polls PRAGMA data_version (a counter SQLite itself maintains, incremented by any connection's write to the file) on a 1-second interval — genuinely cross-process — and only pays for a full re-query and diff when that counter has actually moved. Bounded to the first 1000 rows per poll.

Identifier safety

Every table/column name that reaches this driver from a structured request (not the free-form SQL editor) is validated with assertSafeIdentifier before being interpolated into a query string — this includes PRAGMA table_info("...")/PRAGMA foreign_key_list("..."), which SQLite has no parameter-binding mechanism for at all. Values are always parameterized (?).

Known limitations

  • Poll-based watching only sees the current top N rows of a table.
  • better-sqlite3's synchronous API means a single slow query blocks the Node event loop for its duration — fine for a browsing tool, not appropriate for a high-concurrency server workload.