Created
June 19, 2011 23:46
-
-
Save jslatts/1034914 to your computer and use it in GitHub Desktop.
vows.js async callback state example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'file remove in watched dir': { | |
topic: function () { | |
var lPath = tPath + '/t2'; | |
try { | |
fs.mkdirSync(lPath, '0755'); | |
} | |
catch (Exception) {} | |
return lPath; | |
}, | |
'calling stalker.watch': { | |
topic: function (lPath) { | |
var that = this; | |
stalker.watch(lPath, | |
function(err, file) { | |
setTimeout(function() { | |
fs.unlink(file); | |
}, 1000); | |
}, function (err, file) { | |
that.callback(err, file, lPath); | |
}); | |
var rPath = lPath + '/temp'; | |
var tStream = fs.createWriteStream(rPath); | |
tStream.end('fancy test file', 'utf8'); | |
}, | |
'fires second callback': function (err, file, lPath) { | |
assert.isNull(err); | |
assert.equal(file, lPath + '/temp'); | |
fs.rmdirSync(lPath); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment