Skip to content

doc: some fs doc improvements - #17692

Closed
jasnell wants to merge 3 commits into
nodejs:masterfrom
jasnell:fs-doc-improvements
Closed

doc: some fs doc improvements#17692
jasnell wants to merge 3 commits into
nodejs:masterfrom
jasnell:fs-doc-improvements

Conversation

@jasnell

Copy link
Copy Markdown
Member

Some improvements

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • documentation is changed or added
  • commit message follows commit guidelines
Affected core subsystem(s)

fs doc

@nodejs-github-botnodejs-github-bot added doc Issues and PRs related to the documentations. fs Issues and PRs related to the fs subsystem / file system. labels Dec 15, 2017
Comment threaddoc/api/fs.md Outdated
following is prone to error:
Note that there is no guaranteed ordering when using asynchronous methods.
So the following is prone to error because the `fs.stat()` operation may
completely before the `fs.rename()` operation.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be completely -> complete instead?

Comment threaddoc/api/fs.md
* Returns: {boolean}

Returns `true` if the `fs.Stats` object describes a character device.
### stats.isDirectory()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: can we add a new line before this for consistency?

Comment threaddoc/api/fs.md
* Returns: {boolean}

Returns `true` if the `fs.Stats` object describes a file system directory.
### stats.isFIFO()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto.

Comment threaddoc/api/fs.md Outdated

* Value: {number}

The timestamp indicating the last time this files status was changed expressed

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:%s/files/file

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this files -> the file or this file's

Comment threaddoc/api/fs.md Outdated

* Value: {Date}

The timestamp indicating the last time this files status was changed.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:%s/files/file

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this files -> the file or this file's

Comment threaddoc/api/fs.md Outdated
The `fs` module provides an API for interacting with the file system in a
manner closely modeled around standard POSIX functions.

To use this module, use:

@vsemozhetbytvsemozhetbytDec 15, 2017

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A nit: I am not sure, but are these two use a bit monotonous?

Comment threaddoc/api/fs.md Outdated
Most `fs` operations accept filepaths that may be specified in the form of
a string, a [`Buffer`][], or a [`URL`][] object using the `file:` protocol.

String form paths are interpretted as UTF-8 character sequences identifying

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

interpretted -> interpreted ?

Comment threaddoc/api/fs.md Outdated
Example using an absolute path on POSIX:

```js
fs.open(Buffer.from('/open/some/file.txt'), (err, fd) => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing flag? ('r'?)

Comment threaddoc/api/fs.md Outdated
operations use these file descriptors to identify and track each specific
file. Windows systems use a different but conceptually similar mechanism for
tracking resources. To simplify things for users, Node.js abstracts away the
specific differences between operating sytems and assigns all open files a

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sytems -> systems

Comment threaddoc/api/fs.md
object.

The object itself emits these events:
All `fs.FSWatcher` objects are [`EventEmitter`][]'s that will emit a `'change'`

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing reference?

Comment threaddoc/api/fs.md Outdated
description: Added times as numbers.
-->

An `fs.Stats` object provides information about a file.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An -> A ?

Comment threaddoc/api/fs.md
Returns `true` if the `fs.Stats` object describes a symbolic link.

*Note*: This method is only valid when using [`fs.lstat()`][]

@vsemozhetbytvsemozhetbytDec 15, 2017

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A nit: delete the extra new line?

Comment threaddoc/api/fs.md Outdated
`fs.writeFile()`, `fs.readFile()`, etc.

*Note:* On Windows, opening an existing hidden file using the `w` flag (either
through `fs.open` or `fs.writeFile`) will fail with `EPERM`. Existing hidden

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fs.open -> fs.open() ?
fs.writeFile -> fs.writeFile() ?

Comment threaddoc/api/fs.md Outdated

*Note:* On Windows, opening an existing hidden file using the `w` flag (either
through `fs.open` or `fs.writeFile`) will fail with `EPERM`. Existing hidden
files can be opened for writing with the `r+` flag. A call to `fs.ftruncate` can

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fs.ftruncate -> fs.ftruncate() ?

Comment threaddoc/api/fs.md Outdated
[`URL`]: url.html#url_the_whatwg_url_api
[`UV_THREADPOOL_SIZE`]: cli.html#cli_uv_threadpool_size_size
[`WriteStream`]: #fs_class_fs_writestream
[`EventEmitter']: events.html

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Erroneous single quote instead of backtick?

@jasnell

Copy link
Copy Markdown
MemberAuthor

jasnell added a commit that referenced this pull request Dec 18, 2017
PR-URL: #17692
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
@jasnell

Copy link
Copy Markdown
MemberAuthor

Landed in 400e73a

@jasnelljasnell closed this Dec 18, 2017
MylesBorins pushed a commit that referenced this pull request Jan 8, 2018
PR-URL: #17692
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
MylesBorins pushed a commit that referenced this pull request Jan 9, 2018
PR-URL: #17692
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
@MylesBorinsMylesBorins mentioned this pull request Jan 10, 2018
@MylesBorins

Copy link
Copy Markdown
Contributor

Are these changes applicable to 6.x or 8.x?

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docIssues and PRs related to the documentations.fsIssues and PRs related to the fs subsystem / file system.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants

@jasnell@MylesBorins@danbev@Trott@lpinca@vsemozhetbyt@nodejs-github-bot