Sha256: bd3931581395c5b04c96006aa9cb543f1889655477ebc25f83bf93bee2de1f95
Contents?: true
Size: 660 Bytes
Versions: 3
Compression:
Stored size: 660 Bytes
Contents
common = require("../common"); assert = common.assert var fs = require("fs"); var path = require("path"); var f = path.join(common.fixturesDir, "x.txt"); var f2 = path.join(common.fixturesDir, "x2.txt"); console.log("watching for changes of " + f); var changes = 0; function watchFile () { fs.watchFile(f, function (curr, prev) { console.log(f + " change"); changes++; assert.ok(curr.mtime != prev.mtime); fs.unwatchFile(f); watchFile(); fs.unwatchFile(f); }); } watchFile(); var fd = fs.openSync(f, "w+"); fs.writeSync(fd, 'xyz\n'); fs.closeSync(fd); process.addListener("exit", function () { assert.ok(changes > 0); });
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
rednode-0.1.2 | ext/node/test/pummel/test-watch-file.js |
rednode-0.1.1 | ext/node/test/pummel/test-watch-file.js |
rednode-0.1.0 | ext/node/test/pummel/test-watch-file.js |