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

tlsopt

v3.1.0

Published

auto-detect TLS settings

Downloads

5

Readme

tlsopt

Load TLS certificates from file system automatically based on CLI options or environment variables.

Environment Variables

TLS_CERT

The TLS_CERT environment variable specifies the path to the primary certificate file. If TLS_KEY is not also specified, the resulting options object will have its pfx property set. If TLS_KEY is also specified, the resulting options object will have its cert property set. If the --tls-cert CLI option was passed, this environment variable is ignored.

TLS_KEY

The TLS_KEY environment variable specifies the path to the private key for the TLS_CERT public certificate. If TLS_CERT is not being used, this environment variable is ignored.

TLS_CA

The TLS_CA environment variable specifies the path to an intermediate certificate authority file for the TLS_CERT and TLS_KEY. If TLS_CERT or TLS_KEY is not being used, this environment variable is ignored.

CLI Options

--tls-cert

The --tls-cert CLI option specifies the path to the primary certificate file. If --tls-key is not also specified, the resulting options object will have its pfx property set. If --tls-key is also specified, the resulting options object will have its cert property set. This overrides the TLS_CERT environment variable.

--tls-key

The --tls-key CLI option specifies the path to the private key for the --tls-cert public certificate. If --tls_cert is not being used, this CLI option is ignored.

--tls-ca

The --tls-ca CLI option specifies the path to an intermediate certificate authority file for the --tls-cert and --tls-key. If --tls_cert or --tls-key is not being used, this CLI option is ignored.

Usage

Synchronous Example

const tlsopt = require("tlsopt");
const https = require("https");
const server = https.createServer(tlsopt.readSync());

Asynchronous Example

const tlsopt = require("tlsopt");
const https = require("https");

tlsopt.read().then(opts => {
    const server = https.createServer(opts);
});

Create Server Example

const tlsopt = require("tlsopt");
const server = tlsopt.createServerSync();
const port = server.tls ? 443 : 80;

server.listen(port);