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

shorturl-tsv-express-middleware

v0.4.0

Published

A simple express middleware that regularly fetches redirects formatted as tsv (tabulator seperated values) to provide short urls. Built with auto-publish by Google Sheets in mind to provide the most comfortable user interface.

Readme

ShortURL TSV Express Middleware

Comfortably manage your shortURLs with Google Sheets

Cross-Platform Compatibility License Buy us a tree

Features

  • Minimal maintenance (small, single NPM dependency) It's 139 simple lines of JavaScript and one dependency to parseurl which comes with express.

  • Manage your shortURLs with Google Sheets No additional persistence needed, set permissions, use formulas and create your own user interfaces.

Installation and Use

Install using npm.

npm install @reasn/shorturl-tsv-express-middleware --save

Then use it in your Node.js script like this:

const express = require('express');
const app = express();  
const createMiddleware = require('./index');

let server;

app.use(createMiddleware({
    url: "URL to your TSV file",
    onError: error => {
        console.error(error);
        server.close();
    }
}));

server = app.listen(process.env.PORT || 3000);

Use Google Sheets as management interface

  • Make sure you have a Google account.
  • Create a new Google Sheet by going to sheet.new.
  • Enter shortUrls in the first columns and the targets to redirect to in the second column.
  • Select File > Publish to the web to open a dialog box headlined Publish to the web.
  • Make sure Link is selected (not Embed).
  • Select Sheet1 (not Entire Document) in the first drop-down.
  • Select Tab-separated values (.tsv) in the second drop-down.
  • Make sure to uncheck Require viewers to sign in ....
  • Make sure to check Automatically republish when changes are made.
  • Copy the url to your newly published file and use it in your script as options.url

Runtime Configuration

Below is an example with all possible options parameters.

app.use(createMiddleware({
    url, // The URL to your TSV file
    onError, // error handler (`error => undfined`)
    request, //request || https.get,
    interval, // Interval to fetch updates, default: 1000 * 60 * 5, i.e. 5 minutes
    preventAutoStart, // Unless set to true, the regular fetching of updates is starts when invoking createMiddleware(), default: false
    updateRoute, // Exposes a route to force updates via GET request. This can be used for a reflected (D)DOS. Check whether that's a threat before using.
    responseCode, // the 3xx HTTP response code, default: 302
    log, // log message handler (`message => undefined`)
    maxOpenRequests, // The number of possible open requests to fetch updates, default: 5
    maxHops, // The number of redirect lookups before assuming a circular redirect, default: 50
    };
}));

server = app.listen(process.env.PORT || 3000);

Contributing

I welcome any contributions, enhancements, and bug-fixes. File an issue on GitHub and submit a pull request.

License

Swagger Express Middleware is 100% free and open-source, under the MIT license. Use it however you want.

This package is Treeware. If you use it in production, then we ask that you buy the world a tree to thank us for our work. By contributing to the Treeware forest you’ll be creating employment for local families and restoring wildlife habitats.