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

https-quick

v1.0.3

Published

a drop in for require('https') with built in key and certs

Downloads

3

Readme

https-quick is a drop in for require('https') it has keys and certificates built in and some additional functionality for when you just want to throw together a quick https server https-quick provides a https certificate and ca certificate for

  • ip's :

    • 127.0.0.1, https://127.0.0.1:3002/
    • 127.0.0.2, https://127.0.0.2:3002/
  • dns names :

    • localhost, https://localhost:3002/
    • tst-server, https://tst-server:3002/

which in this simplest form executes

when the quick function is called https-quick

  • adds onerror and onlistening functions
  • calls server.listen
  • returns the server object for chaining
  • the first number in the parameter list is used as the port i.e quick(2154) will start the server listening on port 2154

  • the first function in the parameter list will be used for the onrequest callback

  • if the string 'hello' is found within the parameter list

    • the server will return a simple hello page on the url /hello
    • it also provides /favicon.ico
    • the cacert can be downloaded from /cacert
    • it adds cors support, for all origins to get and post requests
    • it adds a 'cache-control:no-store' header
  • if the string 'nokeys' is not present

    • adds keyboard event to allow escape to be pressed to quit the process

note :

if the parameter 'hello' is used, https-quick can potentially respond to a request before any user defined request listeners, therefore when using the 'hello' parameter later request listeners need to check that the response writableEnded flag is set to false before processing the request

  • it requires the request and response streams as arguments
  • the response has statusCode 200
  • the response has content-type text/plain
  • the response has body that contains the text in msg
  • it requires the request and response streams as arguments
  • the response has statusCode 400
  • the response has content-type text/plain
  • the response has body that contains the text in msg
  • it requires the request and response streams as arguments
  • the response has statusCode 404
  • the response has content-type text/html
  • the response has body that contains the text from msg

add a url to serve

  • url, the url to serve, if the url already exists it is removed

  • callback, can take a number of forms

    • a function to be called when a request for the url is made, the function is called with arguments req,res

    • a string taken to be html and given in response

    • an object

      • if the object has a 'file' key this is taken as a filename if the object has a 'ins' key this is used to search and replace within the file text

      • if the object has a 'string' key this is taken as html if the object has a 'ins' key this is used to search and replace within the html

a number of functions allow strings to be inserted into text, by supplying an object whose

  • the keys are surrounded by double braces '{' and used as the search parameter, all occurrences are replaced
  • the value is used for the replace text

assigns a file to be served when the given url is accessed, if the insert parameter is given ( see above ), the file is converted to text and search and replace is performed on the text

generates a random alpha-numeric url, 10 characters in length if callback is given quick.url(url,callback) is called

removes the given from the current list

serve the files in directory dir from the url starting with baseurl the exclude parameter is an array of relative paths from dir to exclude from serving

remove the directory dir from being served from baseurl

processes a post request with content-type application/json returns a promise which resolves to a javascript json value

send a html response, html is the string to return and search and replace is performed ( see above ) using the insert parameter

send a json response

send a file if the insert parameter is given the file is converted to text and search and replace performed ( see above )

a convenience function to test if the given file resolves into directory dir

  • returns the absolute filename if true
  • false on failure

a convenience function to test if a given file file exists in directory dir return a promise that resolves into the absolute filename if true or false on failure


example useage:

see github examples directory for more woking examples