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

ws-filewatcher

v0.2.0

Published

Ws-Filewatcher is a cli that will watch for file change and open a websocket server where it will send a message everytime the file is updated

Downloads

5

Readme

Ws-Filewatcher

Ws-Filewatcher is a cli that will watch for file change and open a websocket server where it will send a message everytime the file is updated

:zap: Requirements

  • Npm or Yarn, the package managers for NodeJs

:wrench: Installation

Here are the instruction to install the cli globally, but you can do it locally on your projects.

npm i -g ws-filewatcher
OR
yarn global add ws-filewatcher

:fire: Usage

Here is the minimum you need to write to launch the service:

ws-filewatcher -f path/to/my/file

:warning: 'path/to/my/file' isn't necessarily an existing file. You may want to listen for a file creation. So if you make a typo in the path, it won't be considered as an error

Options

| | Verbose | | ------------- | --------------- | | parameter | --verbose | | shortcut | -v | | default value | (bool)false | | description | Allow loggings |

| | Port | | ------------- | ------------------------------------ | | parameter | --port | | shortcut | -p | | default value | (number)9999 | | description | Set the port of the WebSocket server |

| | Command | | ------------- | -------------------------------------------- | | parameter | --command | | shortcut | -c | | default value | (string)"" | | description | The command will be run on every file update |

Full example

ws-filewatcher -f path/to/my/file -p 8080 -v -c 'cp folder/file other/folder/file'

Client example

The example assume you are running the code inside a browser

const ws = new WebSocket('ws://localhost:9999')

ws.onmessage = () => {
    console.log('My file was updated!')
}