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