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 🙏

© 2024 – Pkg Stats / Ryan Hefner

fingerer

v0.4.0

Published

The Super Simple Finger Protocol (RFC 1288) App Framework

Downloads

3

Readme

fingerer

The Super Simple Finger Protocol (RFC 1288) Application Framework

Installation

npm install --save fingerer

Usage

Below is some sample code that will get you going:

// index.js
var fingerer = require("fingerer");
var fingerService = fingerer();

fingerService.index(function(res) {
    res.write("I'm on the index!");
});

fingerService.use(/^([a-z \.]+)$/gi, function(res) {
    res.write("I'm on path " + res.matches[0] + "!");
});

fingerService.listen(function(server) {
    console.log("Finger server listening on " + server.port);
});

Check out the examples to learn more on how to use fingerer.

API

FingerService : fingerer()

Creates a fingerer service instance.

FingerService.use([{RegExp|string} queryMatcher], {function} handler)

Installs a query router middleware.

  • queryMatcher - Optional. Either RegExp or String. Is used by the query router to determine if the Strings will be converted to a regular expression.

  • handler - The middleware that will be invoked if the query matches. It takes the following arguments ({Object} res, {function} next). If the handler returns a truthy value the finger service won't close the connection automatically when all middlewares have processed.

    • {Object} res - The responder object. Contains the following:
      • {String} query - The finger client's query
      • {function} write(string[, encoding]) - Writes the given string to socket
      • {function} writeLine(string[, encoding]) - Writes the given string to socket together with a newline at the end
      • {function} flush() - Flushes the strings to the socket and closes the connection.
      • {Array[String]} matches - The regular expression matches from the queryMatcher.
    • {function} next - When invoked will tell the query router to continue to the next middleware.

FingerService.index({function} handler)

Convenience method to FingerService.use(...) with a queryMatcher that matches the null query, i.e. an empty string.

FingerService.listen(function onStart[, {Object} options])

Starts the finger server.

  • onStart - The function will be called when the service has started.
  • options - Options for the finger server. Contains the following parameters:
    • port - The port to listen on. Default: 79 (Port for finger, see RFC 1288).
    • address - The address

Middlewares

Much like middleware in e.g. Express app, a middleware is a function that takes a responder/parameters object and a next function. Calling the next function will tell fingerer to continue to the next middleware.

function myMiddleware(res, next) {
  res.write("Passing through!")
  next();
}

fingerServer.use(myMiddleware);

Other than that the following middlewares are also available:

fingerer.disableIndex([{string} rejectMessage])

Creates a middleware that will block other query route handlers or middlewares from being used if the client is using a null query, i.e. empty string. Usage:

// takes a refusal message
var mw = fingerer.disableIndex("You can't look into the index!");
fingerServer.use(mw);
  • rejectMessage - Optional message sent to the finger client when the null query was matched. Default: "Finger online user list denied"

License

MIT (c) Mikael Brassman 2016