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 🙏

© 2026 – Pkg Stats / Ryan Hefner

sharef

v1.1.0

Published

Quickly share a file over HTTP

Readme

sharef

Quickly share a file over HTTP, DAT, and Hypercore.

Installation

$ npm install sharef

Usage

sharef can be used as a module or from the command line. sharef is a function that accepts a random-access-storage interface or a string that resolves to random-access-http or random-access-file.

Command Line

sharef describes the following command line usage.

usage: sharef [-hDV] [options] <pathspec>

Options:
  -h, --help     Show help                          [boolean]
  -V, --version  Show version number                [boolean]
  -D, --debug    Enable debug output                [boolean] [default: false]
  -p, --port     Port for HTTP server to listen on  [number] [default: 8000]
  -m, --max      Max shares before exiting          [number] [default: Infinity]

Example

The following example will read a file from github using a ranged request. The request is made to the sharef server and accessed using a random-access-http. When a share has occurred, the server wil close itself.

const fetch = require('got')
const share = require('sharef')

const file = 'https://raw.githubusercontent.com/datproject/hyperdrive-http/master/index.js'
const port = 8000

const server = share(file, { port })

server.once('share', onshare)
server.on('error', onerror)

void async function main() {
  const id = server.id.toString('hex')
  const res = await fetch(`http://localhost:${port}/${id}`, {
    headers: { range: 'bytes=0-100' }
  })

  console.log(res.body);
}()

async function onshare(info) {
  server.close()
}

function onerror(err) {
  console.error(err.stack || err)
}

This example can be recreated on the command line by invoking the following command:

$ sharef https://raw.githubusercontent.com/datproject/hyperdrive-http/master/index.js
 info Sharing file: https://raw.githubusercontent.com/datproject/hyperdrive-http/master/index.js
 info Server Port: 8000
 info Server ID: /b0d4281e
 info Share IP: 192.168.128.111
 info Share URL: http://192.168.128.111:8000/b0d4281e

In another terminal you can request this file with curl.

$ curl http://192.168.128.111:8000/b0d4281e

API

server = share(storage, opts)

share() returns a http.Server instances that responds to a single route

server.id

A random 4 byte buffer used to identify this route.

server.route

A RegExp instance created from path-to-regexp that creates a unique route from server.id

server.on('share', info)

Emitted each time a "share" occurs. That is a successful request and response of the shared file.

License

MIT