This package is no longer relevant as Node.js 0.12 is unmaintained.
Node.js 0.12
fs.access()
&fs.accessSync()
ponyfill
$ npm install --save fs-access
var fsAccess = require('fs-access');
fsAccess('unicorn.txt', function (err) {
if (err) {
console.error('no access');
return;
}
console.log('access');
});
var fsAccess = require('fs-access');
try {
fsAccess.sync('unicorn.txt');
console.log('access');
} catch (err) {
console.error('no access');
}
See the fs.access()
& fs.accessSync()
docs.
Mode flags are on the fsAccess
instance instead of fs
. Only the F_OK
mode is supported.
MIT © Sindre Sorhus