Socket
Socket
Sign inDemoInstall

watch-glob

Package Overview
Dependencies
11
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    watch-glob

Watch glob patterns


Version published
Weekly downloads
316
increased by4.64%
Maintainers
1
Install size
1.91 MB
Created
Weekly downloads
 

Readme

Source

watch-glob

Watch files and directories with glob patterns

Installation

npm install watch-glob

Usage

watchGlob(patterns, [options], addedCallback, [removedCallback] ])

  • patterns - a glob pattern or array of glob patterns to watch
  • options - the base folder in which to search for the patterns (equivalent to options.cwd) an options object to pass to glob(), plus the following:
    • callbackArg - how the file should be represented on the callback
      • absolute - absolute path
      • relative - path relative to `options.cwd´
      • vinyl - a vinyl-fs object (experimental)
      • object(default) - { base, path, relative }
    • delay - (default: 2000) sometimes Gaze does not seem to correctly watch folders which have not been created yet. Therefore, a 2000ms delay is used
  • updateCallback - function to be called when a file is changed, created, or "created" through a rename
  • removeCallback - function to be called after a file is is deleted or "deleted" through a rename

Example

var watchGlob = require('watch-glob'),
    coffee = require('coffee-files');

watchGlob(['tmp/**/*', 'lib/**/*'], { callbackArg: 'relative' }, function(filePath) {
  // Perform livereload
});

watchGlob('coffee/**/*.coffee', { cwd: 'src' }, function(filepath) {
  coffee.file(filepath.path, 'build/' + filepath.relative);
});

Keywords

FAQs

Last updated on 02 May 2014

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc