doc: add callback function signatures in fs.md · nodejs/node@6e06d0e

@@ -324,6 +324,7 @@ added: v0.11.15

324324

* `path` {string|Buffer}

325325

* `mode` {integer}

326326

* `callback` {Function}

327+

* `err` {Error}

327328328329

Tests a user's permissions for the file or directory specified by `path`.

329330

The `mode` argument is an optional integer that specifies the accessibility

@@ -460,6 +461,7 @@ added: v0.6.7

460461

* `mode` {integer} default = `0o666`

461462

* `flag` {string} default = `'a'`

462463

* `callback` {Function}

464+

* `err` {Error}

463465464466

Asynchronously append data to a file, creating the file if it does not yet exist.

465467

`data` can be a string or a buffer.

@@ -506,6 +508,7 @@ added: v0.1.30

506508

* `path` {string|Buffer}

507509

* `mode` {integer}

508510

* `callback` {Function}

511+

* `err` {Error}

509512510513

Asynchronous chmod(2). No arguments other than a possible exception are given

511514

to the completion callback.

@@ -529,6 +532,7 @@ added: v0.1.97

529532

* `uid` {integer}

530533

* `gid` {integer}

531534

* `callback` {Function}

535+

* `err` {Error}

532536533537

Asynchronous chown(2). No arguments other than a possible exception are given

534538

to the completion callback.

@@ -551,6 +555,7 @@ added: v0.0.2

551555552556

* `fd` {integer}

553557

* `callback` {Function}

558+

* `err` {Error}

554559555560

Asynchronous close(2). No arguments other than a possible exception are given

556561

to the completion callback.

@@ -688,6 +693,7 @@ deprecated: v1.0.0

688693689694

* `path` {string|Buffer}

690695

* `callback` {Function}

696+

* `exists` {Boolean}

691697692698

Test whether or not the given path exists by checking with the file system.

693699

Then call the `callback` argument with either true or false. Example:

@@ -806,6 +812,7 @@ added: v0.4.7

806812

* `fd` {integer}

807813

* `mode` {integer}

808814

* `callback` {Function}

815+

* `err` {Error}

809816810817

Asynchronous fchmod(2). No arguments other than a possible exception

811818

are given to the completion callback.

@@ -829,6 +836,7 @@ added: v0.4.7

829836

* `uid` {integer}

830837

* `gid` {integer}

831838

* `callback` {Function}

839+

* `err` {Error}

832840833841

Asynchronous fchown(2). No arguments other than a possible exception are given

834842

to the completion callback.

@@ -851,6 +859,7 @@ added: v0.1.96

851859852860

* `fd` {integer}

853861

* `callback` {Function}

862+

* `err` {Error}

854863855864

Asynchronous fdatasync(2). No arguments other than a possible exception are

856865

given to the completion callback.

@@ -871,6 +880,8 @@ added: v0.1.95

871880872881

* `fd` {integer}

873882

* `callback` {Function}

883+

* `err` {Error}

884+

* `stats` {fs.Stats}

874885875886

Asynchronous fstat(2). The callback gets two arguments `(err, stats)` where

876887

`stats` is an [`fs.Stats`][] object. `fstat()` is identical to [`stat()`][],

@@ -892,6 +903,7 @@ added: v0.1.96

892903893904

* `fd` {integer}

894905

* `callback` {Function}

906+

* `err` {Error}

895907896908

Asynchronous fsync(2). No arguments other than a possible exception are given

897909

to the completion callback.

@@ -913,6 +925,7 @@ added: v0.8.6

913925

* `fd` {integer}

914926

* `len` {integer} default = `0`

915927

* `callback` {Function}

928+

* `err` {Error}

916929917930

Asynchronous ftruncate(2). No arguments other than a possible exception are

918931

given to the completion callback.

@@ -977,6 +990,7 @@ added: v0.4.2

977990

* `atime` {integer}

978991

* `mtime` {integer}

979992

* `callback` {Function}

993+

* `err` {Error}

980994981995

Change the file timestamps of a file referenced by the supplied file

982996

descriptor.

@@ -1003,6 +1017,7 @@ deprecated: v0.4.7

10031017

* `path` {string|Buffer}

10041018

* `mode` {integer}

10051019

* `callback` {Function}

1020+

* `err` {Error}

1006102110071022

Asynchronous lchmod(2). No arguments other than a possible exception

10081023

are given to the completion callback.

@@ -1028,6 +1043,7 @@ deprecated: v0.4.7

10281043

* `uid` {integer}

10291044

* `gid` {integer}

10301045

* `callback` {Function}

1046+

* `err` {Error}

1031104710321048

Asynchronous lchown(2). No arguments other than a possible exception are given

10331049

to the completion callback.

@@ -1051,6 +1067,7 @@ added: v0.1.31

10511067

* `existingPath` {string|Buffer}

10521068

* `newPath` {string|Buffer}

10531069

* `callback` {Function}

1070+

* `err` {Error}

1054107110551072

Asynchronous link(2). No arguments other than a possible exception are given to

10561073

the completion callback.

@@ -1072,6 +1089,8 @@ added: v0.1.30

1072108910731090

* `path` {string|Buffer}

10741091

* `callback` {Function}

1092+

* `err` {Error}

1093+

* `stats` {fs.Stats}

1075109410761095

Asynchronous lstat(2). The callback gets two arguments `(err, stats)` where

10771096

`stats` is a [`fs.Stats`][] object. `lstat()` is identical to `stat()`,

@@ -1095,6 +1114,7 @@ added: v0.1.8

10951114

* `path` {string|Buffer}

10961115

* `mode` {integer}

10971116

* `callback` {Function}

1117+

* `err` {Error}

1098111810991119

Asynchronous mkdir(2). No arguments other than a possible exception are given

11001120

to the completion callback. `mode` defaults to `0o777`.

@@ -1118,6 +1138,8 @@ added: v5.10.0

11181138

* `options` {string|Object}

11191139

* `encoding` {string} default = `'utf8'`

11201140

* `callback` {Function}

1141+

* `err` {Error}

1142+

* `folder` {string}

1121114311221144

Creates a unique temporary directory.

11231145

@@ -1195,6 +1217,8 @@ added: v0.0.2

11951217

* `flags` {string|number}

11961218

* `mode` {integer}

11971219

* `callback` {Function}

1220+

* `err` {Error}

1221+

* `fd` {integer}

1198122211991223

Asynchronous file open. See open(2). `flags` can be:

12001224

@@ -1301,6 +1325,9 @@ added: v0.0.2

13011325

* `length` {integer}

13021326

* `position` {integer}

13031327

* `callback` {Function}

1328+

* `err` {Error}

1329+

* `bytesRead` {integer}

1330+

* `buffer` {Buffer}

1304133113051332

Read data from the file specified by `fd`.

13061333

@@ -1326,6 +1353,8 @@ added: v0.1.8

13261353

* `options` {string|Object}

13271354

* `encoding` {string} default = `'utf8'`

13281355

* `callback` {Function}

1356+

* `err` {Error}

1357+

* `files` {string[]|Buffer[]}

1329135813301359

Asynchronous readdir(3). Reads the contents of a directory.

13311360

The callback gets two arguments `(err, files)` where `files` is an array of

@@ -1363,6 +1392,8 @@ added: v0.1.29

13631392

* `encoding` {string|null} default = `null`

13641393

* `flag` {string} default = `'r'`

13651394

* `callback` {Function}

1395+

* `err` {Error}

1396+

* `data` {string|Buffer}

1366139713671398

Asynchronously reads the entire contents of a file. Example:

13681399

@@ -1441,6 +1472,8 @@ added: v0.1.31

14411472

* `options` {string|Object}

14421473

* `encoding` {string} default = `'utf8'`

14431474

* `callback` {Function}

1475+

* `err` {Error}

1476+

* `linkString` {string|Buffer}

1444147714451478

Asynchronous readlink(2). The callback gets two arguments `(err,

14461479

linkString)`.

@@ -1488,6 +1521,8 @@ added: v0.1.31

14881521

* `options` {string|Object}

14891522

* `encoding` {string} default = `'utf8'`

14901523

* `callback` {Function}

1524+

* `err` {Error}

1525+

* `resolvedPath` {string|Buffer}

1491152614921527

Asynchronous realpath(3). The `callback` gets two arguments `(err,

14931528

resolvedPath)`. May use `process.cwd` to resolve relative paths.

@@ -1525,6 +1560,7 @@ added: v0.0.2

15251560

* `oldPath` {string|Buffer}

15261561

* `newPath` {string|Buffer}

15271562

* `callback` {Function}

1563+

* `err` {Error}

1528156415291565

Asynchronous rename(2). No arguments other than a possible exception are given

15301566

to the completion callback.

@@ -1546,6 +1582,7 @@ added: v0.0.2

1546158215471583

* `path` {string|Buffer}

15481584

* `callback` {Function}

1585+

* `err` {Error}

1549158615501587

Asynchronous rmdir(2). No arguments other than a possible exception are given

15511588

to the completion callback.

@@ -1572,6 +1609,8 @@ added: v0.0.2

1572160915731610

* `path` {string|Buffer}

15741611

* `callback` {Function}

1612+

* `err` {Error}

1613+

* `stats` {fs.Stats}

1575161415761615

Asynchronous stat(2). The callback gets two arguments `(err, stats)` where

15771616

`stats` is an [`fs.Stats`][] object.

@@ -1604,6 +1643,7 @@ added: v0.1.31

16041643

* `path` {string|Buffer}

16051644

* `type` {string}

16061645

* `callback` {Function}

1646+

* `err` {Error}

1607164716081648

Asynchronous symlink(2). No arguments other than a possible exception are given

16091649

to the completion callback. The `type` argument can be set to `'dir'`,

@@ -1639,6 +1679,7 @@ added: v0.8.6

16391679

* `path` {string|Buffer}

16401680

* `len` {integer} default = `0`

16411681

* `callback` {Function}

1682+

* `err` {Error}

1642168316431684

Asynchronous truncate(2). No arguments other than a possible exception are

16441685

given to the completion callback. A file descriptor can also be passed as the

@@ -1662,6 +1703,7 @@ added: v0.0.2

1662170316631704

* `path` {string|Buffer}

16641705

* `callback` {Function}

1706+

* `err` {Error}

1665170716661708

Asynchronous unlink(2). No arguments other than a possible exception are given

16671709

to the completion callback.

@@ -1682,6 +1724,8 @@ added: v0.1.31

1682172416831725

* `filename` {string|Buffer}

16841726

* `listener` {Function}

1727+

* `eventType` {string}

1728+

* `filename` {string|Buffer}

1685172916861730

Stop watching for changes on `filename`. If `listener` is specified, only that

16871731

particular listener is removed. Otherwise, *all* listeners are removed and you

@@ -1703,6 +1747,7 @@ added: v0.4.2

17031747

* `atime` {integer}

17041748

* `mtime` {integer}

17051749

* `callback` {Function}

1750+

* `err` {Error}

1706175117071752

Change file timestamps of the file referenced by the supplied path.

17081753

@@ -1743,6 +1788,8 @@ added: v0.5.10

17431788

* `encoding` {string} Specifies the character encoding to be used for the

17441789

filename passed to the listener. default = `'utf8'`

17451790

* `listener` {Function}

1791+

* `eventType` {string}

1792+

* `filename` {string|Buffer}

1746179317471794

Watch for changes on `filename`, where `filename` is either a file or a

17481795

directory. The returned object is a [`fs.FSWatcher`][].

@@ -1840,6 +1887,8 @@ added: v0.1.31

18401887

* `persistent` {boolean}

18411888

* `interval` {integer}

18421889

* `listener` {Function}

1890+

* `current` {fs.Stats}

1891+

* `previous` {fs.Stats}

1843189218441893

Watch for changes on `filename`. The callback `listener` will be called each

18451894

time the file is accessed.

@@ -1887,6 +1936,9 @@ added: v0.0.2

18871936

* `length` {integer}

18881937

* `position` {integer}

18891938

* `callback` {Function}

1939+

* `err` {Error}

1940+

* `bytesWritten` {integer}

1941+

* `buffer` {Buffer|Uint8Array}

1890194218911943

Write `buffer` to the file specified by `fd`.

18921944

@@ -1918,6 +1970,9 @@ added: v0.11.5

19181970

* `position` {integer}

19191971

* `encoding` {string}

19201972

* `callback` {Function}

1973+

* `err` {Error}

1974+

* `written` {integer}

1975+

* `string` {string}

1921197619221977

Write `string` to the file specified by `fd`. If `string` is not a string, then

19231978

the value will be coerced to one.

@@ -1956,6 +2011,7 @@ added: v0.1.29

19562011

* `mode` {integer} default = `0o666`

19572012

* `flag` {string} default = `'w'`

19582013

* `callback` {Function}

2014+

* `err` {Error}

1959201519602016

Asynchronously writes data to a file, replacing the file if it already exists.

19612017

`data` can be a string or a buffer.