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

@leichtgewicht/quickhost

v1.1.0

Published

Hosts html files temporarily based on a max amount of size in a LRU cache. Allows upload using secret keys.

Downloads

6

Readme

Quickhost

Server and upload-client to quickly host a single static html page - useful for browserstack test.

Motivation

To test JavaScript code running in a browser, browserStack offers a good test platform but the selenium tests require the html files to be available in the internet. The problem is if you have files locally: how can you make them accessible by browserstack?

This is a simple http hosting server that - using a secret - allows to upload any given html file and hosts it for a limited amount of time. It also has a limit on amount of files to be hosted which means it cleans up after itself.

Start a server

Prerequisites: Node running!

$ env \
    QUICKHOST_SECRET=$(node -p "crypto.randomBytes(8).toString('hex')") \
    QUICKHOST_MAX=10 # (optional) Max number of html files to be hosted - default 10 \
    QUICKHOST_MAX_SIZE=3145728 # (optional) Max number of bytes of a file to be hosted - default 3 Megabytes \
    PORT=1234 # (optional) Port where the server will connect to - default 1234 \
    HOST=localhost # (optional) Host where the server will connect to - default 0 \
    npx quickhost

Important note: You should run nginx and letsencrypt to have turn the server into an https server.

Upload

Once the server is running you can upload and download files from that server using a simple API:

  1. npm install @leichtgewicht/quickhost
  2. const upload = require('quickhost')
    const download = require('node-fetch')
    const server = 'https://quickhost.my-host.com'
    
    const key = await upload({
      server, // Server url where the quickhost server is running
      secret: 'secret-from-server', // Secret used when starting the quickhost server
      data: '<html><b>Hello World</b></html>', // Data to be uploaded to the quickhost server
      timeout: 5000 // Timeout for the upload
    })
    
    const data = await fetch(`${server}/${key}`) // Now we can download the server

License

MIT