You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
constfd=fs.openSync(p,'rs+')//by pass file system cache
4
+
console.log("file descriptor "+fd)
5
+
fs.closeSync(fd);
6
+
7
+
/*
8
+
The following flags are available wherever the flag option takes a string.
9
+
10
+
'a': Open file for appending. The file is created if it does not exist.
11
+
12
+
'ax': Like 'a' but fails if the path exists.
13
+
14
+
'a+': Open file for reading and appending. The file is created if it does not exist.
15
+
16
+
'ax+': Like 'a+' but fails if the path exists.
17
+
18
+
'as': Open file for appending in synchronous mode. The file is created if it does not exist.
19
+
20
+
'as+': Open file for reading and appending in synchronous mode. The file is created if it does not exist.
21
+
22
+
'r': Open file for reading. An exception occurs if the file does not exist.
23
+
24
+
'rs': Open file for reading in synchronous mode. An exception occurs if the file does not exist.
25
+
26
+
'r+': Open file for reading and writing. An exception occurs if the file does not exist.
27
+
28
+
'rs+': Open file for reading and writing in synchronous mode. Instructs the operating system to bypass the local file system cache.
29
+
30
+
This is primarily useful for opening files on NFS mounts as it allows skipping the potentially stale local cache. It has a very real impact on I/O performance so using this flag is not recommended unless it is needed.
31
+
32
+
This doesn't turn fs.open() or fsPromises.open() into a synchronous blocking call. If synchronous operation is desired, something like fs.openSync() should be used.
33
+
34
+
'w': Open file for writing. The file is created (if it does not exist) or truncated (if it exists).
35
+
36
+
'wx': Like 'w' but fails if the path exists.
37
+
38
+
'w+': Open file for reading and writing. The file is created (if it does not exist) or truncated (if it exists).
0 commit comments