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 🙏

© 2025 – Pkg Stats / Ryan Hefner

twsql

v0.1.2

Published

Twitter client that uses sql commands rather than a stream

Readme

tsql

A stupid stupid twitter client that uses sql commands to get tweets. Did I mention that this is totally stupid?

const config = {
  "twitter" : {
    "consumer_key": "",
    "consumer_secret": "",
    "access_token": "",
    "access_token_secret": ""
  }
}

const t = require('./twsql.js');
const tsql = new t(config);

tsql.query("select id, text from home").then(function(data){
  console.log(data);
});

or from the command line

chmod 755 console.js
./console.js select id, text, created_at from home where id between 1 and 900000000000000000 limit 10

What columns can I select

Any property of the tweet. Can link into sub-objects as if they were joined tables. e.g.

select user.name from home

Child objects of the Tweet object are implicitly 'joined'.

Can use the as keyword to alias the columns.

What 'tables'

home is a protected keyword, just like on twitter.com, and uses the authenticated user's home timeline. Anything else is treated as a screen name and searches that user's tweets.

What about joins?

Can join media and hashtags. Fields on those tables are accessed as if they are joined tables. e.g. select media.media_url from home join media or select hashtags.text from home join hashtags

The timeline being queried will always be assumed to the first table in the from list.

What filters can I use

id can be filtered using <, >, and between. include_retweets is a boolean to filter retweets from the results. exclude_replies is a boolean to filter replies from the results.

LIMIT

Uses the MySql syntax for limiting

LIMIT 2 Returns 2 rows.

LIMIT 1,2 Returns 2 rows, offset by 1

TODO

  • Further parsing of WHERE clauses into timeline filters
  • Better Table joining. Should be able to handle LEFT vs INNER joins
  • ORDER BY
  • The rest of the entities object, co-ordinates objects, and other sub-objects that are arrays.