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

syncthing-hooks

v0.4.0

Published

Run shell scripts via event hook files (similar to Git hooks) when changes are detected in a [Syncthing](https://syncthing.net/) folder.

Downloads

12

Readme

syncthing-hooks

Run shell scripts via event hook files (similar to Git hooks) when changes are detected in a Syncthing folder.

Prerequisites

Node.js >= 10

Installation

npm i -g syncthing-hooks

Usage

You can simply run the watcher process via:

API_KEY=mykey syncthing-hooks

Don't forget to substitute mykey with your syncthing API key, which can be found in the settings in the GUI.

If Syncthing runs on another host or listens to a non-default port, you can specify an URL by using ST_URL. Note that this URL has to include the protocol, hostname, port and path, e.g.:

ST_URL=http://<ip>:8384/rest/events

It won't install itself as a daemon by default, however. In order to run it as a service, it is recommended to install pm2:

npm i -g pm2

You can then register it as a daemon via:

pm2 start "API_KEY=mykey syncthing-hooks" --name sthooks

To create the daemon automatically on startup, consult this documentation.

You can follow the output of your hooks by using:

pm2 logs

Hooks

Create a folder in your home directory called .syncthing-hooks. A different directory can be set using ST_HOOK_ROOT. Each hook is a file with the following naming scheme:

folder-name-delay

The folder name is the 11 character unique string found in the syncthing GUI. The delay is a string (anything parseable by the ms module) indicating the idle time after an event, so that hooks aren't executed multiple times on successive changes in a short interval.

An example: a script at the location ~/.syncthing-hooks/night-owlzz-5m will be executed five minutes after the most recent event in the folder with the identifier night-owlzz.

Don't forget to chmod +x the script.