JSPM

  • Created
  • Published
  • Downloads 5445
  • Score
    100M100P100Q118372F
  • License MIT

A simple file watcher for Node

Package Exports

  • nsfw

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (nsfw) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

node-sentinel-file-watcher

Linux OS X Windows
A simple file watcher library for node.

Usage

var nsfw = require('node-sentinel-file-watcher');
var watcherOne = new nsfw(
  'dir1',
  function(events) {
  // handle events
  },
  function(error) {
    // handle errors
  }
);
var watcherTwo = new nsfw(
  'dir2',
  function(events) {
  // handles other events
  },
  function(error) {
    // handle errors
  },
  5000
); // every 5 seconds

Callback Argument

An array of events as they have happened in a directory, it's children, or to a file.

[
  {
    "action": "CHANGED",
    "directory": "/home/nsfw/watchDir",
    "file": "file1.ext"
  },
  {
    "action": "CREATED",
    "directory": "/home/nsfw/watchDir",
    "file": "folder"
  },
  {
    "action": "DELETED",
    "directory": "home/nsfw/watchDir/testFolder",
    "file": "test.ext"
  },
  {
    "action": "RENAMED",
    "directory": "home/nsfw/watchDir",
    "oldFile": "oldname.ext",
    "newFile": "newname.ext"
  }
]