var checkPermission = function (file, mask, cb){
fs.stat (file, function (error, stats){
if (error){
cb (error, false);
}else{
cb (null, !!(mask & parseInt ((stats.mode & parseInt ("777", 8)).toString (8)[0])));
}
});
};
canExecute():
checkPermission (<path>, 1, cb);
canRead():
checkPermission (<path>, 4, cb);
canWrite():
checkPermission (<path>, 2, cb);
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…