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

siftdb

v0.2.2

Published

TypeScript client library for SiftDB HTTP API

Downloads

3

Readme

SiftDB TypeScript Client

Official TypeScript/JavaScript client library for SiftDB HTTP API.

Installation

npm install siftdb

For Node.js environments without built-in fetch support (Node.js < 18), also install:

npm install node-fetch
npm install --save-dev @types/node-fetch

Quick Start

Basic Usage

import { SiftDBClient } from 'siftdb';

// Create client instance
const client = new SiftDBClient({
  baseUrl: 'http://localhost:8080',
  defaultCollection: '/path/to/my/collection'
});

// Search for text
const results = await client.search('function main', {
  pathFilter: '**/*.rs',
  limit: 50
});

console.log(`Found ${results.total_matches} matches in ${results.duration_ms}ms`);
results.results.forEach(hit => {
  console.log(`${hit.file_path}:${hit.line_number}: ${hit.line_content}`);
});

Import Files

// Import files into a collection
const importResult = await client.importFiles('/path/to/source', {
  includePatterns: ['**/*.ts', '**/*.js'],
  excludePatterns: ['**/node_modules/**']
});

console.log(`Imported ${importResult.files_ingested} files`);

List Collections

// List available collections
const collections = await client.listCollections();
collections.collections.forEach(collection => {
  console.log(`${collection.name}: ${collection.total_files} files`);
});

API Reference

Client Configuration

interface ClientOptions {
  baseUrl?: string;        // Default: 'http://localhost:8080'
  timeout?: number;        // Default: 30000 (30 seconds)
  defaultCollection?: string;
}

Search Options

interface SearchOptions {
  collection?: string;     // Override default collection
  pathFilter?: string;     // Glob pattern to filter files
  regex?: boolean;         // Treat query as regex pattern
  limit?: number;          // Max results (default: 1000)
}

Import Options

interface ImportOptions {
  collection?: string;         // Override default collection
  includePatterns?: string[];  // Glob patterns to include
  excludePatterns?: string[];  // Glob patterns to exclude
}

Error Handling

import { SiftDBClient, SiftDBException } from 'siftdb-client';

try {
  const results = await client.search('my query');
} catch (error) {
  if (error instanceof SiftDBException) {
    console.error(`SiftDB Error: ${error.message}`);
    if (error.statusCode) {
      console.error(`HTTP Status: ${error.statusCode}`);
    }
  } else {
    console.error('Unexpected error:', error);
  }
}

Browser Usage

The client works in browsers with built-in fetch support:

<script type="module">
import { SiftDBClient } from 'siftdb';

const client = new SiftDBClient({
  baseUrl: 'https://my-siftdb-server.com'
});

// Use client methods...
</script>

Node.js Usage

For Node.js 18+, no additional dependencies needed. For older versions:

// Install node-fetch first: npm install node-fetch @types/node-fetch
import { SiftDBClient } from 'siftdb';

const client = new SiftDBClient();
// Client will automatically use node-fetch if global fetch is unavailable

License

MIT