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

tool-db-cli

v0.0.3

Published

run tooldb command from commandline

Downloads

10

Readme

tool-db-cli

DISCLAIMER: WORK IN PROGRESS/NOT PRODUCTION-READY

tool-db runs a tool-db server from your command line

Installation

npm i -g tool-db-cli

Example: Watching an expression

Start local tool-db server:

tool-db serve watch=foobar

Connect and put data from another local server:

tool-db put --peers=0.0.0.0:8000 foobar myvalue

Example: Using repl

Start local tool-db server with --repl

tool-db serve --repl

Output


ToolDB node running at http://127.0.0.1:8080

Storage:  tooldb
>

You can access access tooldb instance directly from repl

> await tooldb.anonSignIn();
> await tooldb.putData("key", "value")

Example: Creating a redundant mesh network

Connecting two browsers, A and B, over a mesh of tool-db peers, 1 through 4

start a small mesh network of tool-db servers, each listening on a different IP and saving data in a different folder.

tool-db --host=8081 --peers=127.0.0.1:8083,127.0.0.1:8084  --storageName=data1 # 1
tool-db --host=8082 --peers=127.0.0.1:8083,127.0.0.1:8084  --storageName=data2 # 2

tool-db --host=8083 --peers=127.0.0.1:8081,127.0.0.1:8082  --storageName=data3 # 3
tool-db --host=8084 --peers=127.0.0.1:8081,127.0.0.1:8082  --storageName=data4 # 4

On client side

<script src="https://unpkg.com/tool-db/bundle.js">
<script>
    const { ToolDb } = tooldb;
    const tdb = new ToolDb({ peers: [{ host: "localhost", port: 8080 }], debug: true });
</script>

now play around with shutting down individual peers and bringing them back online

As long as there is a path through the mesh network, the heartbeats will propagate from B to A.

But if peers 1 and 2 (or peers 3 and 4) simultainiously go down, A and B are seperated and updates won't go through. However, ToolDB peers will try to reestablish the connection to a lost peer, so as soon as you bring one of the peers back online, they will reconnect and updates will go through again.

Usage

tool-db serve

start tool-db server on http

Options:
  --version      Show version number                                   [boolean]
  --help         Show help                                             [boolean]
  --db           database name to use                                   [string]
  --storageName  our storage namespace              [string] [default: "tooldb"]
  --peers        comma-seperated list of URLs and IPs                   [string]
  --watch        comma-separated list of keys to watch                  [string]
  --host         set ip to listen on             [string] [default: "127.0.0.1"]
  --port         set port to listen on                  [number] [default: 8080]
  --repl         go into a repl (with tooldb instace)                     [boolean]
  --debug        enable debug mode                    [boolean] [default: false]