fsevents
Native Access to Mac OS-X FSEvents
Last updated 8 years ago by pipobscure .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install fsevents 
SYNC missed versions from official npm registry.

fsevents NPM

Native access to OS X FSEvents in Node.js

The FSEvents API in OS X allows applications to register for notifications of changes to a given directory tree. It is a very fast and lightweight alternative to kqueue.

This is a low-level library. For a cross-compatible file watching module that uses fsevents, check out Chokidar.

Installation

$ npm install fsevents

Usage

const fsevents = require('fsevents');
let stop = fsevents.watch(__dirname, (path, flags, id)=>{
  const info = fsevents.getInfo(path, flags, id);
}); // To start observation
stop(); // To end observation

Callback

The callback passed as the second parameter to .watch get's called whenever the operating system detects a a change in the file system. It takes three arguments:

  • path - which is a string naming the path of the item in the filesystem that changed
  • flags - a numeric value describing what the change was
  • id - a unique-id identifying this specific event

getInfo(path, flags, id) => {info-object}

The getInfo function takes the path, flags and id arguments and converts those parameters into a structure that is easier to digest to determine what the change was.

The info-object has the following shape:

{
  "event": "<deleted|moved|created|modified|root-changed|unknown>",
  "path": "<path-that-this-is-about>",
  "type": "<file|directory|symlink>",
  "changes": {
    "inode": true, // Has the iNode Meta-Information changed
    "finder": false, // Has the Finder Meta-Data changed
    "access": false, // Have the access permissions changed
    "xattrs": false // Have the xAttributes changed
  },
  "flags": <raw-flags>
}

MIT License

Copyright (C) 2010-2018 by Philipp Dunkel, Ben Noordhuis, Elan Shankar

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Current Tags

  • 2.3.3                                ...           latest (3 years ago)
  • 1.2.13                                ...           nan (7 years ago)

67 Versions

  • 2.3.3                                ...           3 years ago
  • 2.3.2                                ...           6 years ago
  • 2.3.1                                ...           6 years ago
  • 2.3.0                                ...           6 years ago
  • 2.2.2                                ...           6 years ago
  • 2.2.1                                ...           6 years ago
  • 2.2.0                                ...           6 years ago
  • 1.2.13 [deprecated]           ...           7 years ago
  • 2.1.3                                ...           7 years ago
  • 1.2.12 [deprecated]           ...           7 years ago
  • 1.2.11 [deprecated]           ...           7 years ago
  • 1.2.10 [deprecated]           ...           7 years ago
  • 2.1.2                                ...           7 years ago
  • 2.1.1                                ...           7 years ago
  • 2.1.0                                ...           7 years ago
  • 2.0.7                                ...           8 years ago
  • 1.2.9 [deprecated]           ...           8 years ago
  • 2.0.6                                ...           8 years ago
  • 2.0.5                                ...           8 years ago
  • 1.2.8 [deprecated]           ...           8 years ago
  • 2.0.4                                ...           8 years ago
  • 2.0.3                                ...           8 years ago
  • 1.2.7 [deprecated]           ...           8 years ago
  • 1.2.6 [deprecated]           ...           8 years ago
  • 2.0.2-pre-1                                ...           8 years ago
  • 2.0.1                                ...           8 years ago
  • 2.0.0                                ...           8 years ago
  • 1.2.4 [deprecated]           ...           9 years ago
  • 1.2.3 [deprecated]           ...           9 years ago
  • 1.2.2 [deprecated]           ...           9 years ago
  • 1.2.0 [deprecated]           ...           9 years ago
  • 1.1.3 [deprecated]           ...           9 years ago
  • 1.1.2 [deprecated]           ...           9 years ago
  • 1.1.1 [deprecated]           ...           10 years ago
  • 1.1.0 [deprecated]           ...           10 years ago
  • 1.0.18-0 [deprecated]           ...           10 years ago
  • 1.0.17 [deprecated]           ...           10 years ago
  • 1.0.15 [deprecated]           ...           10 years ago
  • 1.0.14 [deprecated]           ...           10 years ago
  • 1.0.12 [deprecated]           ...           11 years ago
  • 1.0.11 [deprecated]           ...           11 years ago
  • 1.0.10 [deprecated]           ...           11 years ago
  • 1.0.9 [deprecated]           ...           11 years ago
  • 1.0.8 [deprecated]           ...           11 years ago
  • 1.0.7 [deprecated]           ...           11 years ago
  • 1.0.6 [deprecated]           ...           11 years ago
  • 1.0.5 [deprecated]           ...           11 years ago
  • 1.0.4 [deprecated]           ...           11 years ago
  • 1.0.3 [deprecated]           ...           11 years ago
  • 1.0.2 [deprecated]           ...           11 years ago
  • 1.0.1 [deprecated]           ...           11 years ago
  • 1.0.0 [deprecated]           ...           11 years ago
  • 0.3.8                                ...           11 years ago
  • 0.3.7                                ...           11 years ago
  • 0.3.6                                ...           12 years ago
  • 0.3.5                                ...           12 years ago
  • 0.3.4                                ...           12 years ago
  • 0.3.3                                ...           12 years ago
  • 0.3.2                                ...           12 years ago
  • 0.3.1                                ...           12 years ago
  • 0.3.0                                ...           12 years ago
  • 0.2.0                                ...           13 years ago
  • 0.1.6                                ...           13 years ago
  • 0.1.5                                ...           13 years ago
  • 0.1.4                                ...           13 years ago
  • 0.1.3                                ...           13 years ago
  • 0.1.1                                ...           13 years ago
Downloads
Total 188
Today 0
This Week 0
This Month 101
Last Day 3
Last Week 14
Last Month 0
Dependencies (0)
None
Dev Dependencies (0)
None

© 2010 - cnpmjs.org x YWFE | Home | YWFE