~ubuntu-branches/ubuntu/saucy/nodejs/saucy

« back to all changes in this revision

Viewing changes to doc/api/api/fs.json

  • Committer: Package Import Robot
  • Author(s): Jérémy Lal
  • Date: 2013-08-14 00:16:46 UTC
  • mfrom: (7.1.40 sid)
  • Revision ID: package-import@ubuntu.com-20130814001646-bzlysfh8sd6mukbo
Tags: 0.10.15~dfsg1-4
* Update 2005 patch, adding a handful of tests that can fail on
  slow platforms.
* Add 1004 patch to fix test failures when writing NaN to buffer
  on mipsel.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
{
2
 
  "source": "doc/api/fs.markdown",
3
 
  "modules": [
4
 
    {
5
 
      "textRaw": "File System",
6
 
      "name": "fs",
7
 
      "stability": 3,
8
 
      "stabilityText": "Stable",
9
 
      "desc": "<p>File I/O is provided by simple wrappers around standard POSIX functions.  To\nuse this module do <code>require(&apos;fs&apos;)</code>. All the methods have asynchronous and\nsynchronous forms.\n\n</p>\n<p>The asynchronous form always take a completion callback as its last argument.\nThe arguments passed to the completion callback depend on the method, but the\nfirst argument is always reserved for an exception. If the operation was\ncompleted successfully, then the first argument will be <code>null</code> or <code>undefined</code>.\n\n</p>\n<p>When using the synchronous form any exceptions are immediately thrown.\nYou can use try/catch to handle exceptions or allow them to bubble up.\n\n</p>\n<p>Here is an example of the asynchronous version:\n\n</p>\n<pre><code>var fs = require(&apos;fs&apos;);\n\nfs.unlink(&apos;/tmp/hello&apos;, function (err) {\n  if (err) throw err;\n  console.log(&apos;successfully deleted /tmp/hello&apos;);\n});</code></pre>\n<p>Here is the synchronous version:\n\n</p>\n<pre><code>var fs = require(&apos;fs&apos;);\n\nfs.unlinkSync(&apos;/tmp/hello&apos;)\nconsole.log(&apos;successfully deleted /tmp/hello&apos;);</code></pre>\n<p>With the asynchronous methods there is no guaranteed ordering. So the\nfollowing is prone to error:\n\n</p>\n<pre><code>fs.rename(&apos;/tmp/hello&apos;, &apos;/tmp/world&apos;, function (err) {\n  if (err) throw err;\n  console.log(&apos;renamed complete&apos;);\n});\nfs.stat(&apos;/tmp/world&apos;, function (err, stats) {\n  if (err) throw err;\n  console.log(&apos;stats: &apos; + JSON.stringify(stats));\n});</code></pre>\n<p>It could be that <code>fs.stat</code> is executed before <code>fs.rename</code>.\nThe correct way to do this is to chain the callbacks.\n\n</p>\n<pre><code>fs.rename(&apos;/tmp/hello&apos;, &apos;/tmp/world&apos;, function (err) {\n  if (err) throw err;\n  fs.stat(&apos;/tmp/world&apos;, function (err, stats) {\n    if (err) throw err;\n    console.log(&apos;stats: &apos; + JSON.stringify(stats));\n  });\n});</code></pre>\n<p>In busy processes, the programmer is <em>strongly encouraged</em> to use the\nasynchronous versions of these calls. The synchronous versions will block\nthe entire process until they complete--halting all connections.\n\n</p>\n<p>Relative path to filename can be used, remember however that this path will be relative\nto <code>process.cwd()</code>.\n\n</p>\n",
10
 
      "methods": [
11
 
        {
12
 
          "textRaw": "fs.rename(path1, path2, [callback])",
13
 
          "type": "method",
14
 
          "name": "rename",
15
 
          "desc": "<p>Asynchronous rename(2). No arguments other than a possible exception are given\nto the completion callback.\n\n</p>\n",
16
 
          "signatures": [
17
 
            {
18
 
              "params": [
19
 
                {
20
 
                  "name": "path1"
21
 
                },
22
 
                {
23
 
                  "name": "path2"
24
 
                },
25
 
                {
26
 
                  "name": "callback",
27
 
                  "optional": true
28
 
                }
29
 
              ]
30
 
            }
31
 
          ]
32
 
        },
33
 
        {
34
 
          "textRaw": "fs.renameSync(path1, path2)",
35
 
          "type": "method",
36
 
          "name": "renameSync",
37
 
          "desc": "<p>Synchronous rename(2).\n\n</p>\n",
38
 
          "signatures": [
39
 
            {
40
 
              "params": [
41
 
                {
42
 
                  "name": "path1"
43
 
                },
44
 
                {
45
 
                  "name": "path2"
46
 
                }
47
 
              ]
48
 
            }
49
 
          ]
50
 
        },
51
 
        {
52
 
          "textRaw": "fs.truncate(fd, len, [callback])",
53
 
          "type": "method",
54
 
          "name": "truncate",
55
 
          "desc": "<p>Asynchronous ftruncate(2). No arguments other than a possible exception are\ngiven to the completion callback.\n\n</p>\n",
56
 
          "signatures": [
57
 
            {
58
 
              "params": [
59
 
                {
60
 
                  "name": "fd"
61
 
                },
62
 
                {
63
 
                  "name": "len"
64
 
                },
65
 
                {
66
 
                  "name": "callback",
67
 
                  "optional": true
68
 
                }
69
 
              ]
70
 
            }
71
 
          ]
72
 
        },
73
 
        {
74
 
          "textRaw": "fs.truncateSync(fd, len)",
75
 
          "type": "method",
76
 
          "name": "truncateSync",
77
 
          "desc": "<p>Synchronous ftruncate(2).\n\n</p>\n",
78
 
          "signatures": [
79
 
            {
80
 
              "params": [
81
 
                {
82
 
                  "name": "fd"
83
 
                },
84
 
                {
85
 
                  "name": "len"
86
 
                }
87
 
              ]
88
 
            }
89
 
          ]
90
 
        },
91
 
        {
92
 
          "textRaw": "fs.chown(path, uid, gid, [callback])",
93
 
          "type": "method",
94
 
          "name": "chown",
95
 
          "desc": "<p>Asynchronous chown(2). No arguments other than a possible exception are given\nto the completion callback.\n\n</p>\n",
96
 
          "signatures": [
97
 
            {
98
 
              "params": [
99
 
                {
100
 
                  "name": "path"
101
 
                },
102
 
                {
103
 
                  "name": "uid"
104
 
                },
105
 
                {
106
 
                  "name": "gid"
107
 
                },
108
 
                {
109
 
                  "name": "callback",
110
 
                  "optional": true
111
 
                }
112
 
              ]
113
 
            }
114
 
          ]
115
 
        },
116
 
        {
117
 
          "textRaw": "fs.chownSync(path, uid, gid)",
118
 
          "type": "method",
119
 
          "name": "chownSync",
120
 
          "desc": "<p>Synchronous chown(2).\n\n</p>\n",
121
 
          "signatures": [
122
 
            {
123
 
              "params": [
124
 
                {
125
 
                  "name": "path"
126
 
                },
127
 
                {
128
 
                  "name": "uid"
129
 
                },
130
 
                {
131
 
                  "name": "gid"
132
 
                }
133
 
              ]
134
 
            }
135
 
          ]
136
 
        },
137
 
        {
138
 
          "textRaw": "fs.fchown(fd, uid, gid, [callback])",
139
 
          "type": "method",
140
 
          "name": "fchown",
141
 
          "desc": "<p>Asynchronous fchown(2). No arguments other than a possible exception are given\nto the completion callback.\n\n</p>\n",
142
 
          "signatures": [
143
 
            {
144
 
              "params": [
145
 
                {
146
 
                  "name": "fd"
147
 
                },
148
 
                {
149
 
                  "name": "uid"
150
 
                },
151
 
                {
152
 
                  "name": "gid"
153
 
                },
154
 
                {
155
 
                  "name": "callback",
156
 
                  "optional": true
157
 
                }
158
 
              ]
159
 
            }
160
 
          ]
161
 
        },
162
 
        {
163
 
          "textRaw": "fs.fchownSync(fd, uid, gid)",
164
 
          "type": "method",
165
 
          "name": "fchownSync",
166
 
          "desc": "<p>Synchronous fchown(2).\n\n</p>\n",
167
 
          "signatures": [
168
 
            {
169
 
              "params": [
170
 
                {
171
 
                  "name": "fd"
172
 
                },
173
 
                {
174
 
                  "name": "uid"
175
 
                },
176
 
                {
177
 
                  "name": "gid"
178
 
                }
179
 
              ]
180
 
            }
181
 
          ]
182
 
        },
183
 
        {
184
 
          "textRaw": "fs.lchown(path, uid, gid, [callback])",
185
 
          "type": "method",
186
 
          "name": "lchown",
187
 
          "desc": "<p>Asynchronous lchown(2). No arguments other than a possible exception are given\nto the completion callback.\n\n</p>\n",
188
 
          "signatures": [
189
 
            {
190
 
              "params": [
191
 
                {
192
 
                  "name": "path"
193
 
                },
194
 
                {
195
 
                  "name": "uid"
196
 
                },
197
 
                {
198
 
                  "name": "gid"
199
 
                },
200
 
                {
201
 
                  "name": "callback",
202
 
                  "optional": true
203
 
                }
204
 
              ]
205
 
            }
206
 
          ]
207
 
        },
208
 
        {
209
 
          "textRaw": "fs.lchownSync(path, uid, gid)",
210
 
          "type": "method",
211
 
          "name": "lchownSync",
212
 
          "desc": "<p>Synchronous lchown(2).\n\n</p>\n",
213
 
          "signatures": [
214
 
            {
215
 
              "params": [
216
 
                {
217
 
                  "name": "path"
218
 
                },
219
 
                {
220
 
                  "name": "uid"
221
 
                },
222
 
                {
223
 
                  "name": "gid"
224
 
                }
225
 
              ]
226
 
            }
227
 
          ]
228
 
        },
229
 
        {
230
 
          "textRaw": "fs.chmod(path, mode, [callback])",
231
 
          "type": "method",
232
 
          "name": "chmod",
233
 
          "desc": "<p>Asynchronous chmod(2). No arguments other than a possible exception are given\nto the completion callback.\n\n</p>\n",
234
 
          "signatures": [
235
 
            {
236
 
              "params": [
237
 
                {
238
 
                  "name": "path"
239
 
                },
240
 
                {
241
 
                  "name": "mode"
242
 
                },
243
 
                {
244
 
                  "name": "callback",
245
 
                  "optional": true
246
 
                }
247
 
              ]
248
 
            }
249
 
          ]
250
 
        },
251
 
        {
252
 
          "textRaw": "fs.chmodSync(path, mode)",
253
 
          "type": "method",
254
 
          "name": "chmodSync",
255
 
          "desc": "<p>Synchronous chmod(2).\n\n</p>\n",
256
 
          "signatures": [
257
 
            {
258
 
              "params": [
259
 
                {
260
 
                  "name": "path"
261
 
                },
262
 
                {
263
 
                  "name": "mode"
264
 
                }
265
 
              ]
266
 
            }
267
 
          ]
268
 
        },
269
 
        {
270
 
          "textRaw": "fs.fchmod(fd, mode, [callback])",
271
 
          "type": "method",
272
 
          "name": "fchmod",
273
 
          "desc": "<p>Asynchronous fchmod(2). No arguments other than a possible exception\nare given to the completion callback.\n\n</p>\n",
274
 
          "signatures": [
275
 
            {
276
 
              "params": [
277
 
                {
278
 
                  "name": "fd"
279
 
                },
280
 
                {
281
 
                  "name": "mode"
282
 
                },
283
 
                {
284
 
                  "name": "callback",
285
 
                  "optional": true
286
 
                }
287
 
              ]
288
 
            }
289
 
          ]
290
 
        },
291
 
        {
292
 
          "textRaw": "fs.fchmodSync(fd, mode)",
293
 
          "type": "method",
294
 
          "name": "fchmodSync",
295
 
          "desc": "<p>Synchronous fchmod(2).\n\n</p>\n",
296
 
          "signatures": [
297
 
            {
298
 
              "params": [
299
 
                {
300
 
                  "name": "fd"
301
 
                },
302
 
                {
303
 
                  "name": "mode"
304
 
                }
305
 
              ]
306
 
            }
307
 
          ]
308
 
        },
309
 
        {
310
 
          "textRaw": "fs.lchmod(path, mode, [callback])",
311
 
          "type": "method",
312
 
          "name": "lchmod",
313
 
          "desc": "<p>Asynchronous lchmod(2). No arguments other than a possible exception\nare given to the completion callback.\n\n</p>\n",
314
 
          "signatures": [
315
 
            {
316
 
              "params": [
317
 
                {
318
 
                  "name": "path"
319
 
                },
320
 
                {
321
 
                  "name": "mode"
322
 
                },
323
 
                {
324
 
                  "name": "callback",
325
 
                  "optional": true
326
 
                }
327
 
              ]
328
 
            }
329
 
          ]
330
 
        },
331
 
        {
332
 
          "textRaw": "fs.lchmodSync(path, mode)",
333
 
          "type": "method",
334
 
          "name": "lchmodSync",
335
 
          "desc": "<p>Synchronous lchmod(2).\n\n</p>\n",
336
 
          "signatures": [
337
 
            {
338
 
              "params": [
339
 
                {
340
 
                  "name": "path"
341
 
                },
342
 
                {
343
 
                  "name": "mode"
344
 
                }
345
 
              ]
346
 
            }
347
 
          ]
348
 
        },
349
 
        {
350
 
          "textRaw": "fs.stat(path, [callback])",
351
 
          "type": "method",
352
 
          "name": "stat",
353
 
          "desc": "<p>Asynchronous stat(2). The callback gets two arguments <code>(err, stats)</code> where\n<code>stats</code> is a <a href=\"#fs_class_fs_stats\">fs.Stats</a> object.  See the <a href=\"#fs_class_fs_stats\">fs.Stats</a>\nsection below for more information.\n\n</p>\n",
354
 
          "signatures": [
355
 
            {
356
 
              "params": [
357
 
                {
358
 
                  "name": "path"
359
 
                },
360
 
                {
361
 
                  "name": "callback",
362
 
                  "optional": true
363
 
                }
364
 
              ]
365
 
            }
366
 
          ]
367
 
        },
368
 
        {
369
 
          "textRaw": "fs.lstat(path, [callback])",
370
 
          "type": "method",
371
 
          "name": "lstat",
372
 
          "desc": "<p>Asynchronous lstat(2). The callback gets two arguments <code>(err, stats)</code> where\n<code>stats</code> is a <code>fs.Stats</code> object. <code>lstat()</code> is identical to <code>stat()</code>, except that if\n<code>path</code> is a symbolic link, then the link itself is stat-ed, not the file that it\nrefers to.\n\n</p>\n",
373
 
          "signatures": [
374
 
            {
375
 
              "params": [
376
 
                {
377
 
                  "name": "path"
378
 
                },
379
 
                {
380
 
                  "name": "callback",
381
 
                  "optional": true
382
 
                }
383
 
              ]
384
 
            }
385
 
          ]
386
 
        },
387
 
        {
388
 
          "textRaw": "fs.fstat(fd, [callback])",
389
 
          "type": "method",
390
 
          "name": "fstat",
391
 
          "desc": "<p>Asynchronous fstat(2). The callback gets two arguments <code>(err, stats)</code> where\n<code>stats</code> is a <code>fs.Stats</code> object. <code>fstat()</code> is identical to <code>stat()</code>, except that\nthe file to be stat-ed is specified by the file descriptor <code>fd</code>.\n\n</p>\n",
392
 
          "signatures": [
393
 
            {
394
 
              "params": [
395
 
                {
396
 
                  "name": "fd"
397
 
                },
398
 
                {
399
 
                  "name": "callback",
400
 
                  "optional": true
401
 
                }
402
 
              ]
403
 
            }
404
 
          ]
405
 
        },
406
 
        {
407
 
          "textRaw": "fs.statSync(path)",
408
 
          "type": "method",
409
 
          "name": "statSync",
410
 
          "desc": "<p>Synchronous stat(2). Returns an instance of <code>fs.Stats</code>.\n\n</p>\n",
411
 
          "signatures": [
412
 
            {
413
 
              "params": [
414
 
                {
415
 
                  "name": "path"
416
 
                }
417
 
              ]
418
 
            }
419
 
          ]
420
 
        },
421
 
        {
422
 
          "textRaw": "fs.lstatSync(path)",
423
 
          "type": "method",
424
 
          "name": "lstatSync",
425
 
          "desc": "<p>Synchronous lstat(2). Returns an instance of <code>fs.Stats</code>.\n\n</p>\n",
426
 
          "signatures": [
427
 
            {
428
 
              "params": [
429
 
                {
430
 
                  "name": "path"
431
 
                }
432
 
              ]
433
 
            }
434
 
          ]
435
 
        },
436
 
        {
437
 
          "textRaw": "fs.fstatSync(fd)",
438
 
          "type": "method",
439
 
          "name": "fstatSync",
440
 
          "desc": "<p>Synchronous fstat(2). Returns an instance of <code>fs.Stats</code>.\n\n</p>\n",
441
 
          "signatures": [
442
 
            {
443
 
              "params": [
444
 
                {
445
 
                  "name": "fd"
446
 
                }
447
 
              ]
448
 
            }
449
 
          ]
450
 
        },
451
 
        {
452
 
          "textRaw": "fs.link(srcpath, dstpath, [callback])",
453
 
          "type": "method",
454
 
          "name": "link",
455
 
          "desc": "<p>Asynchronous link(2). No arguments other than a possible exception are given to\nthe completion callback.\n\n</p>\n",
456
 
          "signatures": [
457
 
            {
458
 
              "params": [
459
 
                {
460
 
                  "name": "srcpath"
461
 
                },
462
 
                {
463
 
                  "name": "dstpath"
464
 
                },
465
 
                {
466
 
                  "name": "callback",
467
 
                  "optional": true
468
 
                }
469
 
              ]
470
 
            }
471
 
          ]
472
 
        },
473
 
        {
474
 
          "textRaw": "fs.linkSync(srcpath, dstpath)",
475
 
          "type": "method",
476
 
          "name": "linkSync",
477
 
          "desc": "<p>Synchronous link(2).\n\n</p>\n",
478
 
          "signatures": [
479
 
            {
480
 
              "params": [
481
 
                {
482
 
                  "name": "srcpath"
483
 
                },
484
 
                {
485
 
                  "name": "dstpath"
486
 
                }
487
 
              ]
488
 
            }
489
 
          ]
490
 
        },
491
 
        {
492
 
          "textRaw": "fs.symlink(linkdata, path, [type], [callback])",
493
 
          "type": "method",
494
 
          "name": "symlink",
495
 
          "desc": "<p>Asynchronous symlink(2). No arguments other than a possible exception are given\nto the completion callback.\n<code>type</code> argument can be either <code>&apos;dir&apos;</code> or <code>&apos;file&apos;</code> (default is <code>&apos;file&apos;</code>).  It is only \nused on Windows (ignored on other platforms).\n\n</p>\n",
496
 
          "signatures": [
497
 
            {
498
 
              "params": [
499
 
                {
500
 
                  "name": "linkdata"
501
 
                },
502
 
                {
503
 
                  "name": "path"
504
 
                },
505
 
                {
506
 
                  "name": "type",
507
 
                  "optional": true
508
 
                },
509
 
                {
510
 
                  "name": "callback",
511
 
                  "optional": true
512
 
                }
513
 
              ]
514
 
            }
515
 
          ]
516
 
        },
517
 
        {
518
 
          "textRaw": "fs.symlinkSync(linkdata, path, [type])",
519
 
          "type": "method",
520
 
          "name": "symlinkSync",
521
 
          "desc": "<p>Synchronous symlink(2).\n\n</p>\n",
522
 
          "signatures": [
523
 
            {
524
 
              "params": [
525
 
                {
526
 
                  "name": "linkdata"
527
 
                },
528
 
                {
529
 
                  "name": "path"
530
 
                },
531
 
                {
532
 
                  "name": "type",
533
 
                  "optional": true
534
 
                }
535
 
              ]
536
 
            }
537
 
          ]
538
 
        },
539
 
        {
540
 
          "textRaw": "fs.readlink(path, [callback])",
541
 
          "type": "method",
542
 
          "name": "readlink",
543
 
          "desc": "<p>Asynchronous readlink(2). The callback gets two arguments <code>(err,\nlinkString)</code>.\n\n</p>\n",
544
 
          "signatures": [
545
 
            {
546
 
              "params": [
547
 
                {
548
 
                  "name": "path"
549
 
                },
550
 
                {
551
 
                  "name": "callback",
552
 
                  "optional": true
553
 
                }
554
 
              ]
555
 
            }
556
 
          ]
557
 
        },
558
 
        {
559
 
          "textRaw": "fs.readlinkSync(path)",
560
 
          "type": "method",
561
 
          "name": "readlinkSync",
562
 
          "desc": "<p>Synchronous readlink(2). Returns the symbolic link&apos;s string value.\n\n</p>\n",
563
 
          "signatures": [
564
 
            {
565
 
              "params": [
566
 
                {
567
 
                  "name": "path"
568
 
                }
569
 
              ]
570
 
            }
571
 
          ]
572
 
        },
573
 
        {
574
 
          "textRaw": "fs.realpath(path, [callback])",
575
 
          "type": "method",
576
 
          "name": "realpath",
577
 
          "desc": "<p>Asynchronous realpath(2).  The callback gets two arguments <code>(err,\nresolvedPath)</code>.  May use <code>process.cwd</code> to resolve relative paths.\n\n</p>\n",
578
 
          "signatures": [
579
 
            {
580
 
              "params": [
581
 
                {
582
 
                  "name": "path"
583
 
                },
584
 
                {
585
 
                  "name": "callback",
586
 
                  "optional": true
587
 
                }
588
 
              ]
589
 
            }
590
 
          ]
591
 
        },
592
 
        {
593
 
          "textRaw": "fs.realpathSync(path)",
594
 
          "type": "method",
595
 
          "name": "realpathSync",
596
 
          "desc": "<p>Synchronous realpath(2). Returns the resolved path.\n\n</p>\n",
597
 
          "signatures": [
598
 
            {
599
 
              "params": [
600
 
                {
601
 
                  "name": "path"
602
 
                }
603
 
              ]
604
 
            }
605
 
          ]
606
 
        },
607
 
        {
608
 
          "textRaw": "fs.unlink(path, [callback])",
609
 
          "type": "method",
610
 
          "name": "unlink",
611
 
          "desc": "<p>Asynchronous unlink(2). No arguments other than a possible exception are given\nto the completion callback.\n\n</p>\n",
612
 
          "signatures": [
613
 
            {
614
 
              "params": [
615
 
                {
616
 
                  "name": "path"
617
 
                },
618
 
                {
619
 
                  "name": "callback",
620
 
                  "optional": true
621
 
                }
622
 
              ]
623
 
            }
624
 
          ]
625
 
        },
626
 
        {
627
 
          "textRaw": "fs.unlinkSync(path)",
628
 
          "type": "method",
629
 
          "name": "unlinkSync",
630
 
          "desc": "<p>Synchronous unlink(2).\n\n</p>\n",
631
 
          "signatures": [
632
 
            {
633
 
              "params": [
634
 
                {
635
 
                  "name": "path"
636
 
                }
637
 
              ]
638
 
            }
639
 
          ]
640
 
        },
641
 
        {
642
 
          "textRaw": "fs.rmdir(path, [callback])",
643
 
          "type": "method",
644
 
          "name": "rmdir",
645
 
          "desc": "<p>Asynchronous rmdir(2). No arguments other than a possible exception are given\nto the completion callback.\n\n</p>\n",
646
 
          "signatures": [
647
 
            {
648
 
              "params": [
649
 
                {
650
 
                  "name": "path"
651
 
                },
652
 
                {
653
 
                  "name": "callback",
654
 
                  "optional": true
655
 
                }
656
 
              ]
657
 
            }
658
 
          ]
659
 
        },
660
 
        {
661
 
          "textRaw": "fs.rmdirSync(path)",
662
 
          "type": "method",
663
 
          "name": "rmdirSync",
664
 
          "desc": "<p>Synchronous rmdir(2).\n\n</p>\n",
665
 
          "signatures": [
666
 
            {
667
 
              "params": [
668
 
                {
669
 
                  "name": "path"
670
 
                }
671
 
              ]
672
 
            }
673
 
          ]
674
 
        },
675
 
        {
676
 
          "textRaw": "fs.mkdir(path, [mode], [callback])",
677
 
          "type": "method",
678
 
          "name": "mkdir",
679
 
          "desc": "<p>Asynchronous mkdir(2). No arguments other than a possible exception are given\nto the completion callback. <code>mode</code> defaults to <code>0777</code>.\n\n</p>\n",
680
 
          "signatures": [
681
 
            {
682
 
              "params": [
683
 
                {
684
 
                  "name": "path"
685
 
                },
686
 
                {
687
 
                  "name": "mode",
688
 
                  "optional": true
689
 
                },
690
 
                {
691
 
                  "name": "callback",
692
 
                  "optional": true
693
 
                }
694
 
              ]
695
 
            }
696
 
          ]
697
 
        },
698
 
        {
699
 
          "textRaw": "fs.mkdirSync(path, [mode])",
700
 
          "type": "method",
701
 
          "name": "mkdirSync",
702
 
          "desc": "<p>Synchronous mkdir(2).\n\n</p>\n",
703
 
          "signatures": [
704
 
            {
705
 
              "params": [
706
 
                {
707
 
                  "name": "path"
708
 
                },
709
 
                {
710
 
                  "name": "mode",
711
 
                  "optional": true
712
 
                }
713
 
              ]
714
 
            }
715
 
          ]
716
 
        },
717
 
        {
718
 
          "textRaw": "fs.readdir(path, [callback])",
719
 
          "type": "method",
720
 
          "name": "readdir",
721
 
          "desc": "<p>Asynchronous readdir(3).  Reads the contents of a directory.\nThe callback gets two arguments <code>(err, files)</code> where <code>files</code> is an array of\nthe names of the files in the directory excluding <code>&apos;.&apos;</code> and <code>&apos;..&apos;</code>.\n\n</p>\n",
722
 
          "signatures": [
723
 
            {
724
 
              "params": [
725
 
                {
726
 
                  "name": "path"
727
 
                },
728
 
                {
729
 
                  "name": "callback",
730
 
                  "optional": true
731
 
                }
732
 
              ]
733
 
            }
734
 
          ]
735
 
        },
736
 
        {
737
 
          "textRaw": "fs.readdirSync(path)",
738
 
          "type": "method",
739
 
          "name": "readdirSync",
740
 
          "desc": "<p>Synchronous readdir(3). Returns an array of filenames excluding <code>&apos;.&apos;</code> and\n<code>&apos;..&apos;</code>.\n\n</p>\n",
741
 
          "signatures": [
742
 
            {
743
 
              "params": [
744
 
                {
745
 
                  "name": "path"
746
 
                }
747
 
              ]
748
 
            }
749
 
          ]
750
 
        },
751
 
        {
752
 
          "textRaw": "fs.close(fd, [callback])",
753
 
          "type": "method",
754
 
          "name": "close",
755
 
          "desc": "<p>Asynchronous close(2).  No arguments other than a possible exception are given\nto the completion callback.\n\n</p>\n",
756
 
          "signatures": [
757
 
            {
758
 
              "params": [
759
 
                {
760
 
                  "name": "fd"
761
 
                },
762
 
                {
763
 
                  "name": "callback",
764
 
                  "optional": true
765
 
                }
766
 
              ]
767
 
            }
768
 
          ]
769
 
        },
770
 
        {
771
 
          "textRaw": "fs.closeSync(fd)",
772
 
          "type": "method",
773
 
          "name": "closeSync",
774
 
          "desc": "<p>Synchronous close(2).\n\n</p>\n",
775
 
          "signatures": [
776
 
            {
777
 
              "params": [
778
 
                {
779
 
                  "name": "fd"
780
 
                }
781
 
              ]
782
 
            }
783
 
          ]
784
 
        },
785
 
        {
786
 
          "textRaw": "fs.open(path, flags, [mode], [callback])",
787
 
          "type": "method",
788
 
          "name": "open",
789
 
          "desc": "<p>Asynchronous file open. See open(2). <code>flags</code> can be:\n\n</p>\n<ul>\n<li><p><code>&apos;r&apos;</code> - Open file for reading.\nAn exception occurs if the file does not exist.</p>\n</li>\n<li><p><code>&apos;r+&apos;</code> - Open file for reading and writing.\nAn exception occurs if the file does not exist.</p>\n</li>\n<li><p><code>&apos;w&apos;</code> - Open file for writing.\nThe file is created (if it does not exist) or truncated (if it exists).</p>\n</li>\n<li><p><code>&apos;w+&apos;</code> - Open file for reading and writing.\nThe file is created (if it does not exist) or truncated (if it exists).</p>\n</li>\n<li><p><code>&apos;a&apos;</code> - Open file for appending.\nThe file is created if it does not exist.</p>\n</li>\n<li><p><code>&apos;a+&apos;</code> - Open file for reading and appending.\nThe file is created if it does not exist.</p>\n</li>\n</ul>\n<p><code>mode</code> defaults to <code>0666</code>. The callback gets two arguments <code>(err, fd)</code>.\n\n</p>\n",
790
 
          "signatures": [
791
 
            {
792
 
              "params": [
793
 
                {
794
 
                  "name": "path"
795
 
                },
796
 
                {
797
 
                  "name": "flags"
798
 
                },
799
 
                {
800
 
                  "name": "mode",
801
 
                  "optional": true
802
 
                },
803
 
                {
804
 
                  "name": "callback",
805
 
                  "optional": true
806
 
                }
807
 
              ]
808
 
            }
809
 
          ]
810
 
        },
811
 
        {
812
 
          "textRaw": "fs.openSync(path, flags, [mode])",
813
 
          "type": "method",
814
 
          "name": "openSync",
815
 
          "desc": "<p>Synchronous open(2).\n\n</p>\n",
816
 
          "signatures": [
817
 
            {
818
 
              "params": [
819
 
                {
820
 
                  "name": "path"
821
 
                },
822
 
                {
823
 
                  "name": "flags"
824
 
                },
825
 
                {
826
 
                  "name": "mode",
827
 
                  "optional": true
828
 
                }
829
 
              ]
830
 
            }
831
 
          ]
832
 
        },
833
 
        {
834
 
          "textRaw": "fs.utimes(path, atime, mtime, [callback])",
835
 
          "type": "method",
836
 
          "name": "utimes",
837
 
          "desc": "<p>Change file timestamps of the file referenced by the supplied path.\n\n</p>\n",
838
 
          "signatures": [
839
 
            {
840
 
              "params": [
841
 
                {
842
 
                  "name": "path"
843
 
                },
844
 
                {
845
 
                  "name": "atime"
846
 
                },
847
 
                {
848
 
                  "name": "mtime"
849
 
                }
850
 
              ]
851
 
            },
852
 
            {
853
 
              "params": [
854
 
                {
855
 
                  "name": "path"
856
 
                },
857
 
                {
858
 
                  "name": "atime"
859
 
                },
860
 
                {
861
 
                  "name": "mtime"
862
 
                },
863
 
                {
864
 
                  "name": "callback",
865
 
                  "optional": true
866
 
                }
867
 
              ]
868
 
            }
869
 
          ]
870
 
        },
871
 
        {
872
 
          "textRaw": "fs.utimesSync(path, atime, mtime)",
873
 
          "type": "method",
874
 
          "name": "utimesSync",
875
 
          "desc": "<p>Change file timestamps of the file referenced by the supplied path.\n\n</p>\n",
876
 
          "signatures": [
877
 
            {
878
 
              "params": [
879
 
                {
880
 
                  "name": "path"
881
 
                },
882
 
                {
883
 
                  "name": "atime"
884
 
                },
885
 
                {
886
 
                  "name": "mtime"
887
 
                }
888
 
              ]
889
 
            }
890
 
          ]
891
 
        },
892
 
        {
893
 
          "textRaw": "fs.futimes(fd, atime, mtime, [callback])",
894
 
          "type": "method",
895
 
          "name": "futimes",
896
 
          "desc": "<p>Change the file timestamps of a file referenced by the supplied file\ndescriptor.\n\n</p>\n",
897
 
          "signatures": [
898
 
            {
899
 
              "params": [
900
 
                {
901
 
                  "name": "fd"
902
 
                },
903
 
                {
904
 
                  "name": "atime"
905
 
                },
906
 
                {
907
 
                  "name": "mtime"
908
 
                }
909
 
              ]
910
 
            },
911
 
            {
912
 
              "params": [
913
 
                {
914
 
                  "name": "fd"
915
 
                },
916
 
                {
917
 
                  "name": "atime"
918
 
                },
919
 
                {
920
 
                  "name": "mtime"
921
 
                },
922
 
                {
923
 
                  "name": "callback",
924
 
                  "optional": true
925
 
                }
926
 
              ]
927
 
            }
928
 
          ]
929
 
        },
930
 
        {
931
 
          "textRaw": "fs.futimesSync(fd, atime, mtime)",
932
 
          "type": "method",
933
 
          "name": "futimesSync",
934
 
          "desc": "<p>Change the file timestamps of a file referenced by the supplied file\ndescriptor.\n\n</p>\n",
935
 
          "signatures": [
936
 
            {
937
 
              "params": [
938
 
                {
939
 
                  "name": "fd"
940
 
                },
941
 
                {
942
 
                  "name": "atime"
943
 
                },
944
 
                {
945
 
                  "name": "mtime"
946
 
                }
947
 
              ]
948
 
            }
949
 
          ]
950
 
        },
951
 
        {
952
 
          "textRaw": "fs.fsync(fd, [callback])",
953
 
          "type": "method",
954
 
          "name": "fsync",
955
 
          "desc": "<p>Asynchronous fsync(2). No arguments other than a possible exception are given\nto the completion callback.\n\n</p>\n",
956
 
          "signatures": [
957
 
            {
958
 
              "params": [
959
 
                {
960
 
                  "name": "fd"
961
 
                },
962
 
                {
963
 
                  "name": "callback",
964
 
                  "optional": true
965
 
                }
966
 
              ]
967
 
            }
968
 
          ]
969
 
        },
970
 
        {
971
 
          "textRaw": "fs.fsyncSync(fd)",
972
 
          "type": "method",
973
 
          "name": "fsyncSync",
974
 
          "desc": "<p>Synchronous fsync(2).\n\n</p>\n",
975
 
          "signatures": [
976
 
            {
977
 
              "params": [
978
 
                {
979
 
                  "name": "fd"
980
 
                }
981
 
              ]
982
 
            }
983
 
          ]
984
 
        },
985
 
        {
986
 
          "textRaw": "fs.write(fd, buffer, offset, length, position, [callback])",
987
 
          "type": "method",
988
 
          "name": "write",
989
 
          "desc": "<p>Write <code>buffer</code> to the file specified by <code>fd</code>.\n\n</p>\n<p><code>offset</code> and <code>length</code> determine the part of the buffer to be written.\n\n</p>\n<p><code>position</code> refers to the offset from the beginning of the file where this data\nshould be written. If <code>position</code> is <code>null</code>, the data will be written at the\ncurrent position.\nSee pwrite(2).\n\n</p>\n<p>The callback will be given three arguments <code>(err, written, buffer)</code> where <code>written</code>\nspecifies how many <em>bytes</em> were written from <code>buffer</code>.\n\n</p>\n<p>Note that it is unsafe to use <code>fs.write</code> multiple times on the same file\nwithout waiting for the callback. For this scenario,\n<code>fs.createWriteStream</code> is strongly recommended.\n\n</p>\n",
990
 
          "signatures": [
991
 
            {
992
 
              "params": [
993
 
                {
994
 
                  "name": "fd"
995
 
                },
996
 
                {
997
 
                  "name": "buffer"
998
 
                },
999
 
                {
1000
 
                  "name": "offset"
1001
 
                },
1002
 
                {
1003
 
                  "name": "length"
1004
 
                },
1005
 
                {
1006
 
                  "name": "position"
1007
 
                },
1008
 
                {
1009
 
                  "name": "callback",
1010
 
                  "optional": true
1011
 
                }
1012
 
              ]
1013
 
            }
1014
 
          ]
1015
 
        },
1016
 
        {
1017
 
          "textRaw": "fs.writeSync(fd, buffer, offset, length, position)",
1018
 
          "type": "method",
1019
 
          "name": "writeSync",
1020
 
          "desc": "<p>Synchronous version of buffer-based <code>fs.write()</code>. Returns the number of bytes\nwritten.\n\n</p>\n",
1021
 
          "signatures": [
1022
 
            {
1023
 
              "params": [
1024
 
                {
1025
 
                  "name": "fd"
1026
 
                },
1027
 
                {
1028
 
                  "name": "buffer"
1029
 
                },
1030
 
                {
1031
 
                  "name": "offset"
1032
 
                },
1033
 
                {
1034
 
                  "name": "length"
1035
 
                },
1036
 
                {
1037
 
                  "name": "position"
1038
 
                }
1039
 
              ]
1040
 
            }
1041
 
          ]
1042
 
        },
1043
 
        {
1044
 
          "textRaw": "fs.writeSync(fd, str, position, [encoding])",
1045
 
          "type": "method",
1046
 
          "name": "writeSync",
1047
 
          "desc": "<p>Synchronous version of string-based <code>fs.write()</code>. <code>encoding</code> defaults to\n<code>&apos;utf8&apos;</code>. Returns the number of <em>bytes</em> written.\n\n</p>\n",
1048
 
          "signatures": [
1049
 
            {
1050
 
              "params": [
1051
 
                {
1052
 
                  "name": "fd"
1053
 
                },
1054
 
                {
1055
 
                  "name": "str"
1056
 
                },
1057
 
                {
1058
 
                  "name": "position"
1059
 
                },
1060
 
                {
1061
 
                  "name": "encoding",
1062
 
                  "optional": true
1063
 
                }
1064
 
              ]
1065
 
            }
1066
 
          ]
1067
 
        },
1068
 
        {
1069
 
          "textRaw": "fs.read(fd, buffer, offset, length, position, [callback])",
1070
 
          "type": "method",
1071
 
          "name": "read",
1072
 
          "desc": "<p>Read data from the file specified by <code>fd</code>.\n\n</p>\n<p><code>buffer</code> is the buffer that the data will be written to.\n\n</p>\n<p><code>offset</code> is offset within the buffer where writing will start.\n\n</p>\n<p><code>length</code> is an integer specifying the number of bytes to read.\n\n</p>\n<p><code>position</code> is an integer specifying where to begin reading from in the file.\nIf <code>position</code> is <code>null</code>, data will be read from the current file position.\n\n</p>\n<p>The callback is given the three arguments, <code>(err, bytesRead, buffer)</code>.\n\n</p>\n",
1073
 
          "signatures": [
1074
 
            {
1075
 
              "params": [
1076
 
                {
1077
 
                  "name": "fd"
1078
 
                },
1079
 
                {
1080
 
                  "name": "buffer"
1081
 
                },
1082
 
                {
1083
 
                  "name": "offset"
1084
 
                },
1085
 
                {
1086
 
                  "name": "length"
1087
 
                },
1088
 
                {
1089
 
                  "name": "position"
1090
 
                },
1091
 
                {
1092
 
                  "name": "callback",
1093
 
                  "optional": true
1094
 
                }
1095
 
              ]
1096
 
            }
1097
 
          ]
1098
 
        },
1099
 
        {
1100
 
          "textRaw": "fs.readSync(fd, buffer, offset, length, position)",
1101
 
          "type": "method",
1102
 
          "name": "readSync",
1103
 
          "desc": "<p>Synchronous version of buffer-based <code>fs.read</code>. Returns the number of\n<code>bytesRead</code>.\n\n</p>\n",
1104
 
          "signatures": [
1105
 
            {
1106
 
              "params": [
1107
 
                {
1108
 
                  "name": "fd"
1109
 
                },
1110
 
                {
1111
 
                  "name": "buffer"
1112
 
                },
1113
 
                {
1114
 
                  "name": "offset"
1115
 
                },
1116
 
                {
1117
 
                  "name": "length"
1118
 
                },
1119
 
                {
1120
 
                  "name": "position"
1121
 
                }
1122
 
              ]
1123
 
            }
1124
 
          ]
1125
 
        },
1126
 
        {
1127
 
          "textRaw": "fs.readSync(fd, length, position, encoding)",
1128
 
          "type": "method",
1129
 
          "name": "readSync",
1130
 
          "desc": "<p>Synchronous version of string-based <code>fs.read</code>. Returns the number of\n<code>bytesRead</code>.\n\n</p>\n",
1131
 
          "signatures": [
1132
 
            {
1133
 
              "params": [
1134
 
                {
1135
 
                  "name": "fd"
1136
 
                },
1137
 
                {
1138
 
                  "name": "length"
1139
 
                },
1140
 
                {
1141
 
                  "name": "position"
1142
 
                },
1143
 
                {
1144
 
                  "name": "encoding"
1145
 
                }
1146
 
              ]
1147
 
            }
1148
 
          ]
1149
 
        },
1150
 
        {
1151
 
          "textRaw": "fs.readFile(filename, [encoding], [callback])",
1152
 
          "type": "method",
1153
 
          "name": "readFile",
1154
 
          "desc": "<p>Asynchronously reads the entire contents of a file. Example:\n\n</p>\n<pre><code>fs.readFile(&apos;/etc/passwd&apos;, function (err, data) {\n  if (err) throw err;\n  console.log(data);\n});</code></pre>\n<p>The callback is passed two arguments <code>(err, data)</code>, where <code>data</code> is the\ncontents of the file.\n\n</p>\n<p>If no encoding is specified, then the raw buffer is returned.\n\n\n</p>\n",
1155
 
          "signatures": [
1156
 
            {
1157
 
              "params": [
1158
 
                {
1159
 
                  "name": "filename"
1160
 
                },
1161
 
                {
1162
 
                  "name": "encoding",
1163
 
                  "optional": true
1164
 
                },
1165
 
                {
1166
 
                  "name": "callback",
1167
 
                  "optional": true
1168
 
                }
1169
 
              ]
1170
 
            }
1171
 
          ]
1172
 
        },
1173
 
        {
1174
 
          "textRaw": "fs.readFileSync(filename, [encoding])",
1175
 
          "type": "method",
1176
 
          "name": "readFileSync",
1177
 
          "desc": "<p>Synchronous version of <code>fs.readFile</code>. Returns the contents of the <code>filename</code>.\n\n</p>\n<p>If <code>encoding</code> is specified then this function returns a string. Otherwise it\nreturns a buffer.\n\n\n</p>\n",
1178
 
          "signatures": [
1179
 
            {
1180
 
              "params": [
1181
 
                {
1182
 
                  "name": "filename"
1183
 
                },
1184
 
                {
1185
 
                  "name": "encoding",
1186
 
                  "optional": true
1187
 
                }
1188
 
              ]
1189
 
            }
1190
 
          ]
1191
 
        },
1192
 
        {
1193
 
          "textRaw": "fs.writeFile(filename, data, [encoding], [callback])",
1194
 
          "type": "method",
1195
 
          "name": "writeFile",
1196
 
          "desc": "<p>Asynchronously writes data to a file, replacing the file if it already exists.\n<code>data</code> can be a string or a buffer. The <code>encoding</code> argument is ignored if\n<code>data</code> is a buffer. It defaults to <code>&apos;utf8&apos;</code>.\n\n</p>\n<p>Example:\n\n</p>\n<pre><code>fs.writeFile(&apos;message.txt&apos;, &apos;Hello Node&apos;, function (err) {\n  if (err) throw err;\n  console.log(&apos;It\\&apos;s saved!&apos;);\n});</code></pre>\n",
1197
 
          "signatures": [
1198
 
            {
1199
 
              "params": [
1200
 
                {
1201
 
                  "name": "filename"
1202
 
                },
1203
 
                {
1204
 
                  "name": "data"
1205
 
                },
1206
 
                {
1207
 
                  "name": "encoding",
1208
 
                  "optional": true
1209
 
                },
1210
 
                {
1211
 
                  "name": "callback",
1212
 
                  "optional": true
1213
 
                }
1214
 
              ]
1215
 
            }
1216
 
          ]
1217
 
        },
1218
 
        {
1219
 
          "textRaw": "fs.writeFileSync(filename, data, [encoding])",
1220
 
          "type": "method",
1221
 
          "name": "writeFileSync",
1222
 
          "desc": "<p>The synchronous version of <code>fs.writeFile</code>.\n\n</p>\n",
1223
 
          "signatures": [
1224
 
            {
1225
 
              "params": [
1226
 
                {
1227
 
                  "name": "filename"
1228
 
                },
1229
 
                {
1230
 
                  "name": "data"
1231
 
                },
1232
 
                {
1233
 
                  "name": "encoding",
1234
 
                  "optional": true
1235
 
                }
1236
 
              ]
1237
 
            }
1238
 
          ]
1239
 
        },
1240
 
        {
1241
 
          "textRaw": "fs.watchFile(filename, [options], listener)",
1242
 
          "type": "method",
1243
 
          "name": "watchFile",
1244
 
          "stability": 2,
1245
 
          "stabilityText": "Unstable.  Use fs.watch instead, if available.",
1246
 
          "desc": "<p>Watch for changes on <code>filename</code>. The callback <code>listener</code> will be called each\ntime the file is accessed.\n\n</p>\n<p>The second argument is optional. The <code>options</code> if provided should be an object\ncontaining two members a boolean, <code>persistent</code>, and <code>interval</code>. <code>persistent</code>\nindicates whether the process should continue to run as long as files are\nbeing watched. <code>interval</code> indicates how often the target should be polled,\nin milliseconds. (On Linux systems with inotify, <code>interval</code> is ignored.) The\ndefault is <code>{ persistent: true, interval: 0 }</code>.\n\n</p>\n<p>The <code>listener</code> gets two arguments the current stat object and the previous\nstat object:\n\n</p>\n<pre><code>fs.watchFile(&apos;message.text&apos;, function (curr, prev) {\n  console.log(&apos;the current mtime is: &apos; + curr.mtime);\n  console.log(&apos;the previous mtime was: &apos; + prev.mtime);\n});</code></pre>\n<p>These stat objects are instances of <code>fs.Stat</code>.\n\n</p>\n<p>If you want to be notified when the file was modified, not just accessed\nyou need to compare <code>curr.mtime</code> and <code>prev.mtime</code>.\n\n\n</p>\n",
1247
 
          "signatures": [
1248
 
            {
1249
 
              "params": [
1250
 
                {
1251
 
                  "name": "filename"
1252
 
                },
1253
 
                {
1254
 
                  "name": "options",
1255
 
                  "optional": true
1256
 
                },
1257
 
                {
1258
 
                  "name": "listener"
1259
 
                }
1260
 
              ]
1261
 
            }
1262
 
          ]
1263
 
        },
1264
 
        {
1265
 
          "textRaw": "fs.unwatchFile(filename)",
1266
 
          "type": "method",
1267
 
          "name": "unwatchFile",
1268
 
          "stability": 2,
1269
 
          "stabilityText": "Unstable.  Use fs.watch instead, if available.",
1270
 
          "desc": "<p>Stop watching for changes on <code>filename</code>.\n\n</p>\n",
1271
 
          "signatures": [
1272
 
            {
1273
 
              "params": [
1274
 
                {
1275
 
                  "name": "filename"
1276
 
                }
1277
 
              ]
1278
 
            }
1279
 
          ]
1280
 
        },
1281
 
        {
1282
 
          "textRaw": "fs.watch(filename, [options], listener)",
1283
 
          "type": "method",
1284
 
          "name": "watch",
1285
 
          "stability": 2,
1286
 
          "stabilityText": "Unstable.  Not available on all platforms.",
1287
 
          "desc": "<p>Watch for changes on <code>filename</code>, where <code>filename</code> is either a file or a\ndirectory.  The returned object is a <a href=\"#fs_class_fs_fswatcher\">fs.FSWatcher</a>.\n\n</p>\n<p>The second argument is optional. The <code>options</code> if provided should be an object\ncontaining a boolean member <code>persistent</code>, which indicates whether the process\nshould continue to run as long as files are being watched. The default is\n<code>{ persistent: true }</code>.\n\n</p>\n<p>The listener callback gets two arguments <code>(event, filename)</code>.  <code>event</code> is either\n&apos;rename&apos; or &apos;change&apos;, and <code>filename</code> is the name of the file which triggered\nthe event.\n\n</p>\n",
1288
 
          "miscs": [
1289
 
            {
1290
 
              "textRaw": "Caveats",
1291
 
              "name": "Caveats",
1292
 
              "type": "misc",
1293
 
              "desc": "<p>The <code>fs.watch</code> API is not 100% consistent across platforms, and is\nunavailable in some situations.\n\n</p>\n",
1294
 
              "miscs": [
1295
 
                {
1296
 
                  "textRaw": "Availability",
1297
 
                  "name": "Availability",
1298
 
                  "type": "misc",
1299
 
                  "desc": "<p>This feature depends on the underlying operating system providing a way\nto be notified of filesystem changes.\n\n</p>\n<ul>\n<li>On Linux systems, this uses <code>inotify</code>.</li>\n<li>On BSD systems (including OS X), this uses <code>kqueue</code>.</li>\n<li>On SunOS systems (including Solaris and SmartOS), this uses <code>event ports</code>.</li>\n<li>On Windows systems, this feature depends on <code>ReadDirectoryChangesW</code>.</li>\n</ul>\n<p>If the underlying functionality is not available for some reason, then\n<code>fs.watch</code> will not be able to function.  You can still use\n<code>fs.watchFile</code>, which uses stat polling, but it is slower and less\nreliable.\n\n</p>\n"
1300
 
                },
1301
 
                {
1302
 
                  "textRaw": "Filename Argument",
1303
 
                  "name": "Filename Argument",
1304
 
                  "type": "misc",
1305
 
                  "desc": "<p>Providing <code>filename</code> argument in the callback is not supported\non every platform (currently it&apos;s only supported on Linux and Windows).  Even\non supported platforms <code>filename</code> is not always guaranteed to be provided.\nTherefore, don&apos;t assume that <code>filename</code> argument is always provided in the\ncallback, and have some fallback logic if it is null.\n\n</p>\n<pre><code>fs.watch(&apos;somedir&apos;, function (event, filename) {\n  console.log(&apos;event is: &apos; + event);\n  if (filename) {\n    console.log(&apos;filename provided: &apos; + filename);\n  } else {\n    console.log(&apos;filename not provided&apos;);\n  }\n});</code></pre>\n"
1306
 
                }
1307
 
              ]
1308
 
            }
1309
 
          ],
1310
 
          "signatures": [
1311
 
            {
1312
 
              "params": [
1313
 
                {
1314
 
                  "name": "filename"
1315
 
                },
1316
 
                {
1317
 
                  "name": "options",
1318
 
                  "optional": true
1319
 
                },
1320
 
                {
1321
 
                  "name": "listener"
1322
 
                }
1323
 
              ]
1324
 
            }
1325
 
          ]
1326
 
        },
1327
 
        {
1328
 
          "textRaw": "fs.createReadStream(path, [options])",
1329
 
          "type": "method",
1330
 
          "name": "createReadStream",
1331
 
          "desc": "<p>Returns a new ReadStream object (See <code>Readable Stream</code>).\n\n</p>\n<p><code>options</code> is an object with the following defaults:\n\n</p>\n<pre><code>{ flags: &apos;r&apos;,\n  encoding: null,\n  fd: null,\n  mode: 0666,\n  bufferSize: 64 * 1024\n}</code></pre>\n<p><code>options</code> can include <code>start</code> and <code>end</code> values to read a range of bytes from\nthe file instead of the entire file.  Both <code>start</code> and <code>end</code> are inclusive and\nstart at 0.\n\n</p>\n<p>An example to read the last 10 bytes of a file which is 100 bytes long:\n\n</p>\n<pre><code>fs.createReadStream(&apos;sample.txt&apos;, {start: 90, end: 99});</code></pre>\n",
1332
 
          "signatures": [
1333
 
            {
1334
 
              "params": [
1335
 
                {
1336
 
                  "name": "path"
1337
 
                },
1338
 
                {
1339
 
                  "name": "options",
1340
 
                  "optional": true
1341
 
                }
1342
 
              ]
1343
 
            }
1344
 
          ]
1345
 
        },
1346
 
        {
1347
 
          "textRaw": "fs.createWriteStream(path, [options])",
1348
 
          "type": "method",
1349
 
          "name": "createWriteStream",
1350
 
          "desc": "<p>Returns a new WriteStream object (See <code>Writable Stream</code>).\n\n</p>\n<p><code>options</code> is an object with the following defaults:\n\n</p>\n<pre><code>{ flags: &apos;w&apos;,\n  encoding: null,\n  mode: 0666 }</code></pre>\n<p><code>options</code> may also include a <code>start</code> option to allow writing data at\nsome position past the beginning of the file.  Modifying a file rather\nthan replacing it may require a <code>flags</code> mode of <code>r+</code> rather than the\ndefault mode <code>w</code>.\n\n</p>\n",
1351
 
          "signatures": [
1352
 
            {
1353
 
              "params": [
1354
 
                {
1355
 
                  "name": "path"
1356
 
                },
1357
 
                {
1358
 
                  "name": "options",
1359
 
                  "optional": true
1360
 
                }
1361
 
              ]
1362
 
            }
1363
 
          ]
1364
 
        }
1365
 
      ],
1366
 
      "classes": [
1367
 
        {
1368
 
          "textRaw": "Class: fs.Stats",
1369
 
          "type": "class",
1370
 
          "name": "fs.Stats",
1371
 
          "desc": "<p>Objects returned from <code>fs.stat()</code>, <code>fs.lstat()</code> and <code>fs.fstat()</code> and their\nsynchronous counterparts are of this type.\n\n</p>\n<ul>\n<li><code>stats.isFile()</code></li>\n<li><code>stats.isDirectory()</code></li>\n<li><code>stats.isBlockDevice()</code></li>\n<li><code>stats.isCharacterDevice()</code></li>\n<li><code>stats.isSymbolicLink()</code> (only valid with  <code>fs.lstat()</code>)</li>\n<li><code>stats.isFIFO()</code></li>\n<li><code>stats.isSocket()</code></li>\n</ul>\n<p>For a regular file <code>util.inspect(stats)</code> would return a string very\nsimilar to this:\n\n</p>\n<pre><code>{ dev: 2114,\n  ino: 48064969,\n  mode: 33188,\n  nlink: 1,\n  uid: 85,\n  gid: 100,\n  rdev: 0,\n  size: 527,\n  blksize: 4096,\n  blocks: 8,\n  atime: Mon, 10 Oct 2011 23:24:11 GMT,\n  mtime: Mon, 10 Oct 2011 23:24:11 GMT,\n  ctime: Mon, 10 Oct 2011 23:24:11 GMT }</code></pre>\n<p>Please note that <code>atime</code>, <code>mtime</code> and <code>ctime</code> are instances\nof [Date][MDN-Date] object and to compare the values of\nthese objects you should use appropriate methods. For most\ngeneral uses [getTime()][MDN-Date-getTime] will return\nthe number of milliseconds elapsed since <em>1 January 1970\n00:00:00 UTC</em> and this integer should be sufficient for\nany comparison, however there additional methods which can\nbe used for displaying fuzzy information. More details can\nbe found in the [MDN JavaScript Reference][MDN-Date] page.\n\n</p>\n"
1372
 
        },
1373
 
        {
1374
 
          "textRaw": "Class: fs.ReadStream",
1375
 
          "type": "class",
1376
 
          "name": "fs.ReadStream",
1377
 
          "desc": "<p><code>ReadStream</code> is a <a href=\"stream.html#stream_readable_stream\">Readable Stream</a>.\n\n</p>\n",
1378
 
          "events": [
1379
 
            {
1380
 
              "textRaw": "Event: 'open'",
1381
 
              "type": "event",
1382
 
              "name": "open",
1383
 
              "params": [],
1384
 
              "desc": "<p>Emitted when the ReadStream&apos;s file is opened.\n\n\n</p>\n"
1385
 
            }
1386
 
          ]
1387
 
        },
1388
 
        {
1389
 
          "textRaw": "Class: fs.FSWatcher",
1390
 
          "type": "class",
1391
 
          "name": "fs.FSWatcher",
1392
 
          "desc": "<p>Objects returned from <code>fs.watch()</code> are of this type.\n\n</p>\n",
1393
 
          "methods": [
1394
 
            {
1395
 
              "textRaw": "watcher.close()",
1396
 
              "type": "method",
1397
 
              "name": "close",
1398
 
              "desc": "<p>Stop watching for changes on the given <code>fs.FSWatcher</code>.\n\n</p>\n",
1399
 
              "signatures": [
1400
 
                {
1401
 
                  "params": []
1402
 
                }
1403
 
              ]
1404
 
            }
1405
 
          ],
1406
 
          "events": [
1407
 
            {
1408
 
              "textRaw": "Event: 'change'",
1409
 
              "type": "event",
1410
 
              "name": "change",
1411
 
              "params": [],
1412
 
              "desc": "<p>Emitted when something changes in a watched directory or file.\nSee more details in <a href=\"#fs_fs_watch_filename_options_listener\">fs.watch</a>.\n\n</p>\n"
1413
 
            },
1414
 
            {
1415
 
              "textRaw": "Event: 'error'",
1416
 
              "type": "event",
1417
 
              "name": "error",
1418
 
              "params": [],
1419
 
              "desc": "<p>Emitted when an error occurs.\n</p>\n"
1420
 
            }
1421
 
          ]
1422
 
        }
1423
 
      ],
1424
 
      "properties": [
1425
 
        {
1426
 
          "textRaw": "fs.WriteStream",
1427
 
          "name": "WriteStream",
1428
 
          "desc": "<p><code>WriteStream</code> is a <a href=\"stream.html#stream_writable_stream\">Writable Stream</a>.\n\n</p>\n",
1429
 
          "events": [
1430
 
            {
1431
 
              "textRaw": "Event: 'open'",
1432
 
              "type": "event",
1433
 
              "name": "open",
1434
 
              "params": [],
1435
 
              "desc": "<p>Emitted when the WriteStream&apos;s file is opened.\n\n</p>\n"
1436
 
            }
1437
 
          ],
1438
 
          "properties": [
1439
 
            {
1440
 
              "textRaw": "file.bytesWritten",
1441
 
              "name": "bytesWritten",
1442
 
              "desc": "<p>The number of bytes written so far. Does not include data that is still queued\nfor writing.\n\n</p>\n"
1443
 
            }
1444
 
          ]
1445
 
        }
1446
 
      ],
1447
 
      "type": "module",
1448
 
      "displayName": "fs"
1449
 
    }
1450
 
  ]
1451
 
}