twreporter-react
Version:
React-Redux site for The Reporter Foundation in Taiwan
54 lines (33 loc) • 1.17 kB
Markdown
# fs-access [](https://travis-ci.org/sindresorhus/fs-access)
> Node.js 0.12 [`fs.access()`](https://nodejs.org/api/fs.html#fs_fs_access_path_mode_callback) & [`fs.accessSync()`](https://nodejs.org/api/fs.html#fs_fs_accesssync_path_mode) ponyfill
> Ponyfill: A polyfill that doesn't overwrite the native method
## Install
```
$ npm install --save fs-access
```
## Usage
```js
var fsAccess = require('fs-access');
fsAccess('unicorn.txt', function (err) {
if (err) {
console.error('no access');
return;
}
console.log('access');
});
```
```js
var fsAccess = require('fs-access');
try {
fsAccess.sync('unicorn.txt');
console.log('access');
} catch (err) {
console.error('no access');
}
```
## API
See the [`fs.access()` & `fs.accessSync()` docs](https://nodejs.org/api/fs.html#fs_fs_access_path_mode_callback).
Mode flags are on the `fsAccess` instance instead of `fs`.
Only the `F_OK` mode is supported for now. [Help welcome for additional modes.](https://github.com/sindresorhus/awesome-electron/issues/1)
## License
MIT © [Sindre Sorhus](http://sindresorhus.com)