Initial commit
[yaffs-website] / node_modules / graceful-fs / README.md
1 # graceful-fs
2
3 graceful-fs functions as a drop-in replacement for the fs module,
4 making various improvements.
5
6 The improvements are meant to normalize behavior across different
7 platforms and environments, and to make filesystem access more
8 resilient to errors.
9
10 ## Improvements over [fs module](http://api.nodejs.org/fs.html)
11
12 graceful-fs:
13
14 * Queues up `open` and `readdir` calls, and retries them once
15   something closes if there is an EMFILE error from too many file
16   descriptors.
17 * fixes `lchmod` for Node versions prior to 0.6.2.
18 * implements `fs.lutimes` if possible. Otherwise it becomes a noop.
19 * ignores `EINVAL` and `EPERM` errors in `chown`, `fchown` or
20   `lchown` if the user isn't root.
21 * makes `lchmod` and `lchown` become noops, if not available.
22 * retries reading a file if `read` results in EAGAIN error.
23
24 On Windows, it retries renaming a file for up to one second if `EACCESS`
25 or `EPERM` error occurs, likely because antivirus software has locked
26 the directory.
27
28 ## USAGE
29
30 ```javascript
31 // use just like fs
32 var fs = require('graceful-fs')
33
34 // now go and do stuff with it...
35 fs.readFileSync('some-file-or-whatever')
36 ```