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

@jamr/sqleasy

v0.2.5

Published

A minimal, type-friendly async wrapper for SQLite using `sql-template-tag` and `sqlite3` for Node.js/TypeScript projects.

Readme

sqleasy

A minimal, type-friendly async wrapper for SQLite and sqlite3 for Node.js/TypeScript projects.

Features

  • Async API for SQLite
  • Includes a streaming interface for large result sets
  • TypeScript support with generics for query results
  • Implements explicit resource management (i.e. await using syntax)
  • Schema initialization support
  • Supports two APIs for safe SQL queries, tagged template literals (ala sql-template-tag) and string queries with parameter substitution

Installation

Don't forget to install sqlite3!

npm install jamiller619/sqleasy sqlite3

Usage

Create a db.ts file:

import sqleasy from 'sqleasy'

// Initialize the database (optionally with a schema)
const connect = await sqleasy(
  '/path/to/my.db',
  `
  CREATE TABLE IF NOT EXISTS users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL
  );
`,
)

// export default connect()
await using db = connect()

Now you can reference your db from anywhere in your project:

import sql from 'sql-template-tag'
import db from './db.ts'

type User = { id: number; name: string }

// Insert a user using query strings and parameter substitution
const userId = await db.run(`INSERT INTO users (name) VALUES (?)`, 'Alice')

// Query a single user with sql tagged template literals
const user = await db.one<User>(
  sql`SELECT * FROM users WHERE name = ${'Alice'}`,
)

// Query all users
const users = await db.many<User>('SELECT * FROM users')

// Stream users
const userStream = db.stream<User>('SELECT * FROM users')

for (const user of userStream) {
  console.log(user.name)
}

API

sqleasy(fileName: string, schema?: string): Promise<() => Driver>

Initializes the SQLite database. Optionally runs a schema SQL string. Returns a function that creates a Driver instance.

Driver

A class that wraps a SQLite database connection and provides async methods:

  • exec(sql: string): Promise<void> — Executes a SQL statement without returning a result.
  • run(sql: Sql | string, ...values: any[]): Promise<number> — Executes a SQL statement and resolves with the last inserted row ID.
  • one<R>(sql: Sql | string, ...values: any[]): Promise<R | undefined> — Fetches a single row from the database.
  • many<R>(sql: Sql | string, ...values: any[]): Promise<R[]> — Fetches all rows from the database.
  • stream<R>(sql: Sql | string, ...values: any[]): DatabaseStream<R> — Returns a stream for the given SQL query.
  • close(): Promise<void> — Closes the underlying database. Can be used with Explicit Resource Management syntax, i.e. using.

TypeScript Support

  • All methods are fully typed.
  • Use generics to specify the result row type for one, many and stream.

License

MIT