Skip to content

Instantly share code, notes, and snippets.

@TyrfingMjolnir
Last active September 16, 2017 10:29
Show Gist options
  • Save TyrfingMjolnir/4f73bf0905be7943f1f184249dcfa8bc to your computer and use it in GitHub Desktop.
Save TyrfingMjolnir/4f73bf0905be7943f1f184249dcfa8bc to your computer and use it in GitHub Desktop.
chokidar RxJS 4.x
const Rx = require( 'rx' ),
chokidar = require( 'chokidar' ),
dirWatcher = chokidar.watch( '/tmp' ),
changedFiles = Rx.Observable.fromEvent( dirWatcher, 'change' ),
subscription = changedFiles.subscribe(
function( filenamefullpath ) {
console.log( filenamefullpath );
},
function( err ) {
console.log( 'Error: ' + err );
},
function () {
console.log( 'Completed' );
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment