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

swarm-cli

v1.2.2

Published

A simple filesystem-backed Swarm client. Works more like a version control system: saves data to plain files, pulls/pushes updates from/to the server. Works offline, reconnects automatically.

Downloads

3

Readme

Swarm command-line client

A simple filesystem-backed Swarm client. Works more like a version control system: saves data to plain files, pulls/pushes updates from/to the server. Works offline, reconnects automatically.

Usage

swarm [options] dbdir/

Options

  • [ ] -- dbdir: replica's home path (default: .)
  • [ ] -C --connect url connect to a server, init a replica
    • [ ] ws://1.2.3.4:5/dbid WebSocket
    • [ ] wss://1.2.3.4:5/dbid WebSocket (secure)
    • [ ] tcp://1.2.3.4:5/dbid TCP
  • [ ] -u --update type/id update (default: all the objects)
  • [ ] -c --create type
  • [ ] -g --get type/id
    • [ ] -r --recur depth recursive retrieval (default: depth 1)
  • [ ] -p --put type/id commit a manually edited JSON object
  • [ ] -o --op type/id feed an op (args or stdin must contain op name, value)
    • [ ] -n --name op name
    • [ ] -v --value op value
  • [ ] -e --edit type/id edit a JSON state, put when done (uses $EDITOR)
  • [ ] -l --log list the log of pending ops (those not acked by the server)
  • [ ] -m --mute ignore connect/listen options in the db
  • [ ] -R --repl run REPL
  • [ ] -E --exec execute script(s), e.g. --exec init.js -e run.js
  • [ ] -T --trace trace incoming/outgoing ops

Examples

# install swarm client (see swarm-server on how to run a server)
$ npm i -g swarm-cli

# connect to the server, init the client
$ swarm -C tcp://gritzko:password@localhost:31415/testdb 

$ cd testdb/

# create an object
$ swarm --create LWWObject
/LWWObject#1GDBdW+Rgritzko01

# see the outer JSON state of the object
$ cat LWWObject/1GDBdW+Rgritzko01.json
{"_id":"1GDBdW+Rgritzko01","_version":"1GDBdW+Rgritzko01"}

# see the inner CRDT state (data+metadata)
$ cat LWWObject/.1GDBdW+Rgritzko01.~

# make a change to the object, see some client-server chit-chat
$ swarm --trace -o LWWObject/1GDBdW+Rgritzko01 -n FieldName -v FieldValue
...
< /LWWObject#1GDBdW+Rgritzko01!1GDBdk+Rgritzko01.FieldName FieldValue
> /LWWObject#1GDBdW+Rgritzko01!1GDBdk+Rgritzko01.FieldName FieldValue
...

# launch REPL, play with the JavaScript API
$ swarm --repl
≶ o = swarm.get('1GDBdW+Rgritzko01', obj => console.log(obj.get('FieldName')));
FieldValue
≶ o.set('FieldName', 'another value');
...