Test if a file or directory is writable. Because sometimes you just gotta know.
var canWrite = ;return;// alternatively:;
Writability does not always imply readability. Think a "Drop Box", wherein guest users can put files in, but cannot read the contents.
To check readability, pass a truthy second parameter:
var canWrite = ;return;
It's an anti-pattern to check writability.
You generally want to just do what you're going to do, then recover from an error.
For example, say you need to create a file:
In other words: don't use this module unless you really, really, really need to check whether something is writable.
$ npm install can-write
© 2015 Christopher Hiller. Licensed MIT.