fsevents
Advanced tools
Comparing version 0.2.0 to 0.3.0
@@ -29,3 +29,2 @@ /* | ||
info.id = id; | ||
if (info.event === 'moved') { | ||
@@ -77,2 +76,4 @@ fs.stat(info.path, function(err, stat) { | ||
if (Native.Constants.kFSEventStreamEventFlagItemModified & flags) return 'modified'; | ||
if (Native.Constants.kFSEventStreamEventFlagRootChanged & flags) return 'root-changed'; | ||
return 'unknown'; | ||
@@ -79,0 +80,0 @@ } |
{ | ||
"name": "fsevents", | ||
"version": "0.2.0", | ||
"version": "0.3.0", | ||
"description": "Native Access to Mac OS-X FSEvents", | ||
"main": "fsevents.js", | ||
"dependencies": { | ||
"nan": "~0.8.0" | ||
"nan": "~1.2.0" | ||
}, | ||
@@ -37,2 +37,2 @@ "os": [ | ||
} | ||
} | ||
} |
@@ -22,7 +22,10 @@ # FSEvents [![NPM](https://nodei.co/npm/fsevents.png)](https://nodei.co/npm/fsevents/) | ||
var fsevents = require('fsevents'); | ||
var watcher = fsevents(__dirname); | ||
watcher.on('fsevent', function(path, flags, id) { }); // RAW Event as emitted by OS-X | ||
watcher.on('change', function(path, info) {}); // Common Event for all changes | ||
// To end observation | ||
```js | ||
var fsevents = require('fsevents'); | ||
var watcher = fsevents(__dirname); | ||
watcher.on('fsevent', function(path, flags, id) { }); // RAW Event as emitted by OS-X | ||
watcher.on('change', function(path, info) {}); // Common Event for all changes | ||
watcher.start() // To start observation | ||
watcher.stop() // To end observation | ||
``` | ||
@@ -41,15 +44,17 @@ ### Events | ||
{ | ||
"event": "<event-type>", | ||
"id": <eventi-id>, | ||
"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> | ||
} | ||
```json | ||
{ | ||
"event": "<event-type>", | ||
"id": <eventi-id>, | ||
"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> | ||
} | ||
``` | ||
@@ -56,0 +61,0 @@ ## MIT License |
/* | ||
** © 2014 by Philipp Dunkel <pip@pipobscure.com> | ||
** Licensed under MIT License. | ||
© 2014 by Philipp Dunkel <pip@pipobscure.com> | ||
Licensed under MIT License. | ||
*/ | ||
@@ -24,2 +24,4 @@ | ||
evt.on('fsevent', function(name, flags, id) { | ||
console.error("id:\t" + id); | ||
console.error("flags:\t" + JSON.stringify(flags)); | ||
if (name === __dirname + '/temp') return; | ||
@@ -37,3 +39,6 @@ if (path.basename(name) === 'created-fsevent') { | ||
evt.on('change', function(name, info) { | ||
//console.error(JSON.stringify(info)); | ||
console.error("name:\t" + name); | ||
console.error("base:\t" + path.basename(name)); | ||
console.error("event:\t" + info.event); | ||
console.error("info:\t" + JSON.stringify(info)); | ||
if (name === __dirname + '/temp') return; | ||
@@ -58,13 +63,28 @@ t.ok(name === info.path, 'matched path'); | ||
setTimeout(function() { | ||
console.error("==========================================================================="); | ||
console.error("\twriteFileSync(__dirname + '/temp/created-fsevent', 'created-fsevent');"); | ||
fs.writeFileSync(__dirname + '/temp/created-fsevent', 'created-fsevent'); | ||
console.error("==========================================================================="); | ||
}, 5000); | ||
setTimeout(function() { | ||
console.error("==========================================================================="); | ||
console.error("\trenameSync(__dirname + '/temp/created-fsevent', __dirname + '/temp/moved-fsevent');"); | ||
fs.renameSync(__dirname + '/temp/created-fsevent', __dirname + '/temp/moved-fsevent'); | ||
console.error("==========================================================================="); | ||
}, 10000); | ||
setTimeout(function() { | ||
console.error("==========================================================================="); | ||
console.error("\tunlinkSync(__dirname + '/temp/moved-fsevent');"); | ||
fs.unlinkSync(__dirname + '/temp/moved-fsevent'); | ||
console.error("==========================================================================="); | ||
}, 15000); | ||
setTimeout(function() { | ||
console.error("==========================================================================="); | ||
console.error("\trmdirSync(__dirname + '/temp');"); | ||
fs.rmdirSync(__dirname + '/temp'); | ||
console.error("==========================================================================="); | ||
}, 20000); | ||
}); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
23191
187
80
1
+ Addednan@1.2.0(transitive)
- Removednan@0.8.0(transitive)
Updatednan@~1.2.0