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

cfhs-js

v0.1.13

Published

Complex HTTP File Server

Downloads

16

Readme

CFHS-js

Complex file HTTP server.

Early WIP.

Features

  • Authentication: UUID tokens are used to manage accessing.
  • Multi-instance: As many instances as you want.
  • Multi-directory: The directories do not have to be located inside one place.

Installation

This project is at the early stage. Simplified installation should be added later.

Now supporting GNU/Linux. BSD users might see problems.

Configuration

Overview

All config files are stored in ~/.config/cfhs-js. It may contain multiple directories; each of them represent one instance. Each instance has 3 files:

  • conf
  • dirs
  • tokens

Config File: conf

This is where main configuration options reside. Now only the port number is configurable.

Example:

Port=1453
ServerName=Example HTTP File Server
UrlPrefix=http://127.0.0.1:1453

This is not shell script, so no need to quote or escape for space characters.

You have to write port number in UrlPrefix again, unless it is the default port of the protocol specified afore. While this program is supposed to listen at a harmless port, users might need to visit through Nginx which listens at 80 or 443, according to your specific setup.

Config File: dirs

Write a list of directories to be shared. Use absolute paths.

Example:

/tmp/cfhs-default:abcd
/tmp/cfhs-new

Optionally append :abcd at the end of a line to let it appear as abcd in the root index. In the example, the 2 directories will appear as abcd and cfhs-new in the root index.

Config File: tokens

Users should not touch this file. The program manages tokens.

This file is a CSV with 5 columns:

Index | Field Name | Details ------- | ----------------- | ------- 0 | Timestamp | Timestamp of generation. 1 | Type | Single uppercase letter. A for admin; V for visitor. 2 | Token | UUID with hyphen. 3 | Path | The path which this token is authorized to access. 4 | Expiry | The expiry date, ISO 8601 format, initial 19 characters.

Manage Instances

Create

cfhs-js-ctl new MyInstanceName

This will create the instance configuration directory.

Start & End Instances

cfhs-js-ctl start MyInstanceName
cfhs-js-ctl end MyInstanceName

You may start and stop instances with the 2 subcommands.

Check Instance Status

cfhs-js-ctl status-all

How Things Work

Process Life Cycle

The program cfhsctl is a small script to manage configrations and processes. It starts and ends serverd.js processes, which actually accepts HTTP requests.

Since this project is an early-stage WIP, you may prefer to use serverd.js with manual configuration, instead of playing with cfhsctl.

Tokens

Tokens include admin tokens and visitor tokens. Admin tokens can be used to generate visitor tokens.

Admin tokens can access all directories and files, but visitor tokens can only access the directories which they are authorized.

Both programs create tokens.

Web User Session

When a user visits a page, the URL should include a token. If the token is an admin token, or a visitor token with correct access at the path, the user will be allowed to see the index of the directory or download the file. When navigating from page to page, the token will be preserved in the URL.

Copyright

Copyright (c) 2021 Neruthes.

Published under GNU GPLv2. See file LICENSE.