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

@ai-yantra/pg-fs

v0.1.1

Published

PostgreSQL-backed filesystem with AI SDK tools for building intelligent file management agents

Readme

@ai-yantra/pg-fs

Database-backed filesystem with AI SDK tools for building file management agents. Supports both PostgreSQL and SQLite as storage backends.

Install

# Core package
npm install @ai-yantra/pg-fs drizzle-orm

# For PostgreSQL backend
npm install pg

# For SQLite backend
npm install better-sqlite3

Quick Start

SQLite (zero-config)

import { createSqliteFs } from '@ai-yantra/pg-fs';

// In-memory — great for testing and ephemeral agents
const dbfs = await createSqliteFs();

// File-based — persistent across restarts
const dbfs = await createSqliteFs('./mydb.sqlite');

await dbfs.fs.writeFile('/hello.txt', 'Hello, World!');
const content = await dbfs.fs.readFile('/hello.txt');

PostgreSQL

import { Pool } from 'pg';
import { DbFs } from '@ai-yantra/pg-fs';

const pool = new Pool({
  connectionString: 'postgresql://localhost:5432/mydb',
});

const dbfs = await DbFs.create({ dialect: 'postgresql', pool });

await dbfs.fs.writeFile('/hello.txt', 'Hello, World!');
const content = await dbfs.fs.readFile('/hello.txt');

Full config

const dbfs = await DbFs.create({
  dialect: 'sqlite',        // or 'postgresql'
  filename: './mydb.sqlite', // SQLite only (default: ':memory:')
  pool: pgPool,              // PostgreSQL only
  autoInitialize: true,      // create tables on startup (default: true)
});

Filesystem API

Files

await dbfs.fs.writeFile(path, content, { mimeType, createParents })
await dbfs.fs.readFile(path)
await dbfs.fs.exists(path)
await dbfs.fs.stat(path)        // { size, modifiedAt, isDirectory }
await dbfs.fs.unlink(path)

Directories

await dbfs.fs.mkdir(path, { recursive: true })
await dbfs.fs.readdir(path)
await dbfs.fs.readdirStats(path)
await dbfs.fs.unlink(path, { recursive: true })

Move, Copy, Search

await dbfs.fs.rename(oldPath, newPath)
await dbfs.fs.copy(src, dest, { recursive: true })
await dbfs.fs.glob('**/*.ts', '/src')
await dbfs.fs.search('TODO', '/')   // full-text search

AI SDK Tools

dbfs.tools gives your agent these tools out of the box:

read write edit ls mkdir unlink rename copy stat exists glob grep

import { openai } from '@ai-sdk/openai';
import { createSqliteFs } from '@ai-yantra/pg-fs';

const dbfs = await createSqliteFs('./agent.sqlite');

const agent = new ToolLoopAgent({
  model: openai('gpt-4'),
  instructions: 'You are a file management assistant.',
  tools: dbfs.tools,
});

await agent.generate({
  prompt: 'Create a project structure for a Node.js app',
});

Direct Database Access

The underlying Drizzle instance is exposed for custom queries:

import { sql } from 'drizzle-orm';
import { nodes } from '@ai-yantra/pg-fs';

const recentFiles = await dbfs.db.query.nodes.findMany({
  where: sql`modified_at > NOW() - INTERVAL '1 hour'`,
});