From 039eb5624950ca5eba46fad8ab78924441d7acfc Mon Sep 17 00:00:00 2001 From: Vse Mozhet Byt Date: Wed, 9 Oct 2019 16:10:19 +0300 Subject: [PATCH] doc: fix some recent nits in fs.md * Fix sorting of sections. * Fix sorting of bottom references. * Wrap lines at 80 chars. * Fix a heading level. PR-URL: https://github.com/nodejs/node/pull/29906 Reviewed-By: Colin Ihrig Reviewed-By: Ruben Bridgewater Reviewed-By: Jeremiah Senkpiel Reviewed-By: Rich Trott --- doc/api/fs.md | 86 ++++++++++++++++++++++++++------------------------- 1 file changed, 44 insertions(+), 42 deletions(-) diff --git a/doc/api/fs.md b/doc/api/fs.md index b5efaba3630299..66cc7d7a7ccbd7 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -291,7 +291,8 @@ added: v12.12.0 A class representing a directory stream. -Created by [`fs.opendir()`][], [`fs.opendirSync()`][], or [`fsPromises.opendir()`][]. +Created by [`fs.opendir()`][], [`fs.opendirSync()`][], or +[`fsPromises.opendir()`][]. ```js const fs = require('fs'); @@ -305,16 +306,6 @@ async function print(path) { print('./').catch(console.error); ``` -### dir.path - - -* {string} - -The read-only path of this directory as was provided to [`fs.opendir()`][], -[`fs.opendirSync()`][], or [`fsPromises.opendir()`][]. - ### dir.close() + +* {string} + +The read-only path of this directory as was provided to [`fs.opendir()`][], +[`fs.opendirSync()`][], or [`fsPromises.opendir()`][]. + ### dir.read() -A representation of a directory entry, as returned by reading from an [`fs.Dir`][]. +A representation of a directory entry, as returned by reading from an +[`fs.Dir`][]. Additionally, when [`fs.readdir()`][] or [`fs.readdirSync()`][] is called with the `withFileTypes` option set to `true`, the resulting array is filled with @@ -2620,33 +2622,6 @@ a colon, Node.js will open a file system stream, as described by Functions based on `fs.open()` exhibit this behavior as well: `fs.writeFile()`, `fs.readFile()`, etc. -## fs.openSync(path\[, flags, mode\]) - - -* `path` {string|Buffer|URL} -* `flags` {string|number} **Default:** `'r'`. - See [support of file system `flags`][]. -* `mode` {integer} **Default:** `0o666` -* Returns: {number} - -Returns an integer representing the file descriptor. - -For detailed information, see the documentation of the asynchronous version of -this API: [`fs.open()`][]. - ## fs.opendir(path\[, options\], callback) + +* `path` {string|Buffer|URL} +* `flags` {string|number} **Default:** `'r'`. + See [support of file system `flags`][]. +* `mode` {integer} **Default:** `0o666` +* Returns: {number} + +Returns an integer representing the file descriptor. + +For detailed information, see the documentation of the asynchronous version of +this API: [`fs.open()`][]. + ## fs.read(fd, buffer, offset, length, position, callback) @@ -5459,6 +5461,7 @@ the file contents. [`Buffer.byteLength`]: buffer.html#buffer_class_method_buffer_bytelength_string_encoding [`Buffer`]: buffer.html#buffer_buffer [`FSEvents`]: https://developer.apple.com/documentation/coreservices/file_system_events +[`Number.MAX_SAFE_INTEGER`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER [`ReadDirectoryChangesW`]: https://docs.microsoft.com/en-us/windows/desktop/api/winbase/nf-winbase-readdirectorychangesw [`ReadStream`]: #fs_class_fs_readstream [`URL`]: url.html#url_the_whatwg_url_api @@ -5505,7 +5508,6 @@ the file contents. [`net.Socket`]: net.html#net_class_net_socket [`stat()`]: fs.html#fs_fs_stat_path_options_callback [`util.promisify()`]: util.html#util_util_promisify_original -[bigints]: https://tc39.github.io/proposal-bigint [Caveats]: #fs_caveats [Common System Errors]: errors.html#errors_common_system_errors [FS Constants]: #fs_fs_constants_1 @@ -5515,7 +5517,7 @@ the file contents. [MSDN-Rel-Path]: https://docs.microsoft.com/en-us/windows/desktop/FileIO/naming-a-file#fully-qualified-vs-relative-paths [MSDN-Using-Streams]: https://docs.microsoft.com/en-us/windows/desktop/FileIO/using-streams [Naming Files, Paths, and Namespaces]: https://docs.microsoft.com/en-us/windows/desktop/FileIO/naming-a-file +[bigints]: https://tc39.github.io/proposal-bigint [chcp]: https://ss64.com/nt/chcp.html [inode]: https://en.wikipedia.org/wiki/Inode [support of file system `flags`]: #fs_file_system_flags -[`Number.MAX_SAFE_INTEGER`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER