Socket
Socket
Sign inDemoInstall

glob-watcher

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

glob-watcher

Watch globs


Version published
Weekly downloads
1.5M
increased by7.12%
Maintainers
1
Weekly downloads
 
Created

What is glob-watcher?

The glob-watcher package is a wrapper around the chokidar library, providing a way to watch file sets defined with glob patterns for changes. It is commonly used in build tools and scripts to automate tasks like reloading, testing, or compiling code when changes are detected in the file system.

What are glob-watcher's main functionalities?

Watching files for changes

This feature allows you to monitor a set of files defined by glob patterns for any changes. When a change is detected, a callback function is executed. It's useful for triggering rebuilds or tests automatically during development.

const { watch } = require('glob-watcher');
watch(['src/**/*.js'], (done) => {
  console.log('Files have changed!');
  done();
});

Debouncing and throttling events

This feature helps in controlling the rate at which events are handled. By debouncing or throttling, you can limit the number of times your callback function is called, which is particularly useful for reducing unnecessary processing during rapid file changes.

const { watch } = require('glob-watcher');
const watcher = watch('src/**/*.js', { delay: 100 });
watcher.on('change', (path) => console.log(`${path} has changed`));

Other packages similar to glob-watcher

FAQs

Package last updated on 15 Apr 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc