fs-lock是Node.js的文件限制,用纯JavaScript写成,用户可以加载其他方法获取访问。
示例代码:
//Do your startup code here, the lock it dow with:require('fs-lock')({ 'file_accessdir': [ __dirame, '/tmp' ], 'ope_basedir': [ '/usr/local/share/ode_modules', __dirame ]});var fs = require('fs');fs.readFile('/etc/passwd', fuctio(err, data) { //this will throw a Access Deied error});
评论