Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 96 additions & 0 deletions doc/api/fs.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -1143,6 +1143,9 @@ changes:
Synchronously changes the permissions of a file. Returns `undefined`.
This is the synchronous version of [`fs.chmod()`][].

For detailed information, see the documentation of
[`fs.chmod()`](#fschmodpath-mode-callback).

See also: chmod(2).

## fs.chown(path, uid, gid, callback)
Expand DownExpand Up@@ -1191,6 +1194,9 @@ changes:
Synchronously changes owner and group of a file. Returns `undefined`.
This is the synchronous version of [`fs.chown()`][].

For detailed information, see the documentation of
[`fs.chown()`](#fschownpath-uid-gid-callback).

See also: chown(2).

## fs.close(fd, callback)
Expand DownExpand Up@@ -1223,6 +1229,9 @@ added: v0.1.21

Synchronous close(2). Returns `undefined`.

For detailed information, see the documentation of
[`fs.close()`](#fsclosefd-callback).

## fs.constants

* {Object}
Expand DownExpand Up@@ -1573,6 +1582,9 @@ changes:
Synchronous version of [`fs.exists()`][].
Returns `true` if the path exists, `false` otherwise.

For detailed information, see the documentation of
[`fs.exists()`](#fsexistspath-callback).

Note that `fs.exists()` is deprecated, but `fs.existsSync()` is not.
(The `callback` parameter to `fs.exists()` accepts parameters that are
inconsistent with other Node.js callbacks. `fs.existsSync()` does not use
Expand DownExpand Up@@ -1610,6 +1622,9 @@ added: v0.4.7

Synchronous fchmod(2). Returns `undefined`.

For detailed information, see the documentation of
[`fs.fchmod()`](#fsfchmodfd-mode-callback).

## fs.fchown(fd, uid, gid, callback)
<!-- YAML
added: v0.4.7
Expand DownExpand Up@@ -1644,6 +1659,9 @@ added: v0.4.7

Synchronous fchown(2). Returns `undefined`.

For detailed information, see the documentation of
[`fs.fchown()`](#fsfchownfd-uid-gid-callback).

## fs.fdatasync(fd, callback)
<!-- YAML
added: v0.1.96
Expand DownExpand Up@@ -1674,6 +1692,9 @@ added: v0.1.96

Synchronous fdatasync(2). Returns `undefined`.

For detailed information, see the documentation of
[`fs.fdatasync()`](#fsfdatasyncfd-callback).

## fs.fstat(fd[, options], callback)
<!-- YAML
added: v0.1.95
Expand DownExpand Up@@ -1722,6 +1743,9 @@ changes:

Synchronous fstat(2).

For detailed information, see the documentation of
[`fs.fstat()`](#fsfstatfd-options-callback).

## fs.fsync(fd, callback)
<!-- YAML
added: v0.1.96
Expand DownExpand Up@@ -1752,6 +1776,9 @@ added: v0.1.96

Synchronous fsync(2). Returns `undefined`.

For detailed information, see the documentation of
[`fs.fsync()`](#fsfsyncfd-callback).

## fs.ftruncate(fd[, len], callback)
<!-- YAML
added: v0.8.6
Expand DownExpand Up@@ -1826,6 +1853,9 @@ added: v0.8.6

Synchronous ftruncate(2). Returns `undefined`.

For detailed information, see the documentation of
[`fs.ftruncate()`](#fsftruncatefd-len-callback).

## fs.futimes(fd, atime, mtime, callback)
<!-- YAML
added: v0.4.2
Expand DownExpand Up@@ -1872,6 +1902,9 @@ changes:

Synchronous version of [`fs.futimes()`][]. Returns `undefined`.

For detailed information, see the documentation of
[`fs.futimes()](#fsfutimesfd-atime-mtime-callback).

## fs.lchmod(path, mode, callback)
<!-- YAML
deprecated: v0.4.7
Expand DownExpand Up@@ -1906,6 +1939,9 @@ deprecated: v0.4.7

Synchronous lchmod(2). Returns `undefined`.

For detailed information, see the documentation of
[`fs.lchmod()`](#fslchmodpath-mode-callback).

## fs.lchown(path, uid, gid, callback)
<!-- YAML
deprecated: v0.4.7
Expand DownExpand Up@@ -1940,6 +1976,9 @@ deprecated: v0.4.7

Synchronous lchown(2). Returns `undefined`.

For detailed information, see the documentation of
[`fs.lchown()`](#fslchownpath-uid-gid-callback).

## fs.link(existingPath, newPath, callback)
<!-- YAML
added: v0.1.31
Expand DownExpand Up@@ -1983,6 +2022,9 @@ changes:

Synchronous link(2). Returns `undefined`.

For detailed information, see the documentation of
[`fs.link()`](#fslinkexistingpath-newpath-callback).

## fs.lstat(path[, options], callback)
<!-- YAML
added: v0.1.30
Expand DownExpand Up@@ -2040,6 +2082,9 @@ changes:

Synchronous lstat(2).

For detailed information, see the documentation of
[`fs.lstat()`](#fslstatpath-options-callback).

## fs.mkdir(path[, mode], callback)
<!-- YAML
added: v0.1.8
Expand DownExpand Up@@ -2084,6 +2129,9 @@ changes:
Synchronously creates a directory. Returns `undefined`.
This is the synchronous version of [`fs.mkdir()`][].

For detailed information, see the documentation of
[`fs.mkdir()`](#fsmkdirpath-mode-callback).

See also: mkdir(2).

## fs.mkdtemp(prefix[, options], callback)
Expand DownExpand Up@@ -2173,6 +2221,9 @@ added: v5.10.0
The synchronous version of [`fs.mkdtemp()`][]. Returns the created
folder path.

For detailed information, see the documentation of
[`fs.mkdtemp()`](#fsmkdtempprefix-options-callback).

The optional `options` argument can be a string specifying an encoding, or an
object with an `encoding` property specifying the character encoding to use.

Expand DownExpand Up@@ -2230,6 +2281,9 @@ changes:
Synchronous version of [`fs.open()`][]. Returns an integer representing the file
descriptor.

For detailed information, see the documentation of
[`fs.open()`](#fsopenpath-flags-mode-callback).

## fs.read(fd, buffer, offset, length, position, callback)
<!-- YAML
added: v0.0.2
Expand DownExpand Up@@ -2324,6 +2378,9 @@ changes:

Synchronous readdir(3).

For detailed information, see the documentation of
[`fs.readdir()`](#fsreaddirpath-options-callback).

The optional `options` argument can be a string specifying an encoding, or an
object with an `encoding` property specifying the character encoding to use for
the filenames passed to the callback. If the `encoding` is set to `'buffer'`,
Expand DownExpand Up@@ -2428,6 +2485,9 @@ changes:

Synchronous version of [`fs.readFile()`][]. Returns the contents of the `path`.

For detailed information, see the documentation of
[`fs.readFile()`](#fsreadfilepath-options-callback).

If the `encoding` option is specified then this function returns a
string. Otherwise it returns a buffer.

Expand DownExpand Up@@ -2493,6 +2553,9 @@ changes:

Synchronous readlink(2). Returns the symbolic link's string value.

For detailed information, see the documentation of
[`fs.readlink()`](#fsreadlinkpath-options-callback).

The optional `options` argument can be a string specifying an encoding, or an
object with an `encoding` property specifying the character encoding to use for
the link path passed to the callback. If the `encoding` is set to `'buffer'`,
Expand All@@ -2516,6 +2579,9 @@ changes:

Synchronous version of [`fs.read()`][]. Returns the number of `bytesRead`.

For detailed information, see the documentation of
[`fs.read()`](#fsreadfd-buffer-offset-length-position-callback).

## fs.realpath(path[, options], callback)
<!-- YAML
added: v0.1.31
Expand DownExpand Up@@ -2631,6 +2697,9 @@ changes:

Synchronous version of [`fs.realpath()`][]. Returns the resolved pathname.

For detailed information, see the documentation of
[`fs.realpath()`](#fsrealpathpath-options-callback).

## fs.realpathSync.native(path[, options])
<!-- YAML
added: v9.2.0
Expand All@@ -2643,6 +2712,9 @@ added: v9.2.0

Synchronous realpath(3).

For detailed information, see the documentation of
[`fs.realpath()`](#fsrealpathpath-options-callback).

Only paths that can be converted to UTF8 strings are supported.

The optional `options` argument can be a string specifying an encoding, or an
Expand DownExpand Up@@ -2708,6 +2780,9 @@ changes:

Synchronous rename(2). Returns `undefined`.

For detailed information, see the documentation of
[`fs.rename()`](#fsrenameoldpath-newpath-callback).

## fs.rmdir(path, callback)
<!-- YAML
added: v0.0.2
Expand DownExpand Up@@ -2750,6 +2825,9 @@ changes:

Synchronous rmdir(2). Returns `undefined`.

For detailed information, see the documentation of
[`fs.rmdir()`](#fsrmdirpath-callback).

Using `fs.rmdirSync()` on a file (not a directory) results in an `ENOENT` error
on Windows and an `ENOTDIR` error on POSIX.

Expand DownExpand Up@@ -2818,6 +2896,9 @@ changes:

Synchronous stat(2).

For detailed information, see the documentation of
[`fs.stat()`](#fsstatpath-options-callback).

## fs.symlink(target, path[, type], callback)
<!-- YAML
added: v0.1.31
Expand DownExpand Up@@ -2867,6 +2948,9 @@ changes:

Synchronous symlink(2). Returns `undefined`.

For detailed information, see the documentation of
[`fs.symlink()`](#fssymlinktarget-path-type-callback).

## fs.truncate(path[, len], callback)
<!-- YAML
added: v0.8.6
Expand DownExpand Up@@ -2904,6 +2988,9 @@ added: v0.8.6
Synchronous truncate(2). Returns `undefined`. A file descriptor can also be
passed as the first argument. In this case, `fs.ftruncateSync()` is called.

For detailed information, see the documentation of
[`fs.truncate()`](#fstruncatepath-len-callback).

Passing a file descriptor is deprecated and may result in an error being thrown
in the future.

Expand DownExpand Up@@ -2959,6 +3046,9 @@ changes:

Synchronous unlink(2). Returns `undefined`.

For detailed information, see the documentation of
[`fs.unlink()`](#fsunlinkpath-callback).

## fs.unwatchFile(filename[, listener])
<!-- YAML
added: v0.1.31
Expand DownExpand Up@@ -3043,6 +3133,9 @@ changes:

Synchronous version of [`fs.utimes()`][]. Returns `undefined`.

For detailed information, see the documentation of
[`fs.utimes()`](#fsutimespath-atime-mtime-callback).

## fs.watch(filename[, options][, listener])
<!-- YAML
added: v0.5.10
Expand DownExpand Up@@ -3431,6 +3524,9 @@ changes:

Synchronous versions of [`fs.write()`][]. Returns the number of bytes written.

For detailed information, see the documentation of
[`fs.writeSync()`](#fswritesyncfd-buffer-offset-length-position).

## fs Promises API

> Stability: 1 - Experimental
Expand Down