the memfs.watch() function doesn't seem to work on directories. The following code works as expected:
var fs = require('fs');
if (fs.vol) fs.vol.fromJSON({ '/tmp': {}});
var fswatcher = fs.watch('/tmp', console.log);
fs.writeFileSync('/tmp/test.file', 'test data');
fs.unlinkSync('/tmp/test.file');
setTimeout(() => {fswatcher.close()}, 500);
Producing the output:
rename test.file
change test.file
rename test.file
but change it to use memfs instead::
var fs = require('memfs');
if (fs.vol) fs.vol.fromJSON({ '/tmp': {}});
var fswatcher = fs.watch('/tmp', console.log);
fs.writeFileSync('/tmp/test.file', 'test data');
fs.unlinkSync('/tmp/test.file');
setTimeout(() => {fswatcher.close()}, 500);
and I get no output.
EDIT: Changed the test code to be a little simpler and make the two cases much closer to each other with only a single line change.
the memfs.watch() function doesn't seem to work on directories. The following code works as expected:
Producing the output:
but change it to use memfs instead::
and I get no output.
EDIT: Changed the test code to be a little simpler and make the two cases much closer to each other with only a single line change.