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

dat-publish

v1.2.0

Published

Publish your dats to HTTP & Dat endpoints!

Downloads

12

Readme

Dat Publish

Publish your dats to HTTP and run a public Dat peer!

Uses hyperdrive-http and dat-archiver to be a publicly accessible archive for your data stored in Dat. Push new files to the server with dat-push.

Serving Dat files over HTTP

  • Run dat-publish on your server. It will print a <server-key> for dat-archiver.
  • Create a dat on your local computer (or use an existing directory without a Dat).
  • dat-push <server-key> [directory]. Push a dat/directory to your server with <server-key>.
  • Your files will be available on your server over http!

Public Dat Peer

You can also use dat-publish to act as a public dat peer.

Follow the same commands as above with the discovery option: dat-publish <server-key> --discovery. After a dat-push is run, dat-publish will share your files on Dat.

Installation

npm install -g dat-publish

Usage

dat-publish [<server-key>] [directory]
  • Set <server-key> to name your sever. When using dat-push, you will push to this key. If you do not set a name, a 16 character key will be generated for you. Anyone with the key will be able to push to your server.
  • directory: store the dat directories. Each dat will be stored in a folder with it's key as the name.

CLI Options

  • --http, -h: Share archive(s) via hyperdrive-http over port.
  • --dat-upload, -u: Share via Dat peer. Join Dat swarm after a dat-push is finished, will only upload data, not download new data.
  • --dat-download, -d: Update dat from live source (dat share on your computer will update the server).
  • --root=<archive-key>, -r: Archive key to serve as root archive.
  • --index=file.html, -i: Page to serve as index for archive(s). If not set, metadata will be served at root.
  • --port=1234: Port for http server

Root Archive Options

You can choose a single archive to serve at the root. This allows you to do things like publish a static website. By default it will serve index.html at the root and the filelist at metadata.json.

If you have a root archive to publish, run:

  • dat-publish my-server-name --root

If you have multiple archives on your dat-archiver, you need to specify the archive key to serve as root:

  • dat-publish my-server-name --root=<dat-link>

Index Page

To show index.html as the index page for all archives, use the --index option:

  • dat-publish my-server-name --root --index

To overwrite the index page for all archives, set the index to the page name:

  • dat-publish my-server-name --root --index=foo.html

API

var publish = datPublish({opts})

Options include:

{
  dir: process.cwd + '/dats', // directory to store dats received from dat-push
  discovery: { // join dat swarm after a completed dat-push
    upload: false, // Upload data to other peers
    download: false // Download live updates from archive source
  },
  rootArchive: <key>, // dat archive key to serve as root of http
  index: 'index.html', // index page for root archive mode
  http: true // return onRequest function for http usage
}

publish.archiver

dat-archiver instance. Use publish.archiver.join(serverKey) to join an archiver server.

publish.httpRequest

hyperdrive-http request function, use this in a http server: server.on('request', publish.httpRequest).

See cli.js for example usage.

License

MIT