Initial commit
[yaffs-website] / node_modules / globule / 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
11
12 graceful-fs:
13
14 * keeps track of how many file descriptors are open, and by default
15   limits this to 1024. Any further requests to open a file are put in a
16   queue until new slots become available. If 1024 turns out to be too
17   much, it decreases the limit further.
18 * fixes `lchmod` for Node versions prior to 0.6.2.
19 * implements `fs.lutimes` if possible. Otherwise it becomes a noop.
20 * ignores `EINVAL` and `EPERM` errors in `chown`, `fchown` or
21   `lchown` if the user isn't root.
22 * makes `lchmod` and `lchown` become noops, if not available.
23 * retries reading a file if `read` results in EAGAIN error.
24
25 On Windows, it retries renaming a file for up to one second if `EACCESS`
26 or `EPERM` error occurs, likely because antivirus software has locked
27 the directory.
28
29 ## Configuration
30
31 The maximum number of open file descriptors that graceful-fs manages may
32 be adjusted by setting `fs.MAX_OPEN` to a different number. The default
33 is 1024.