Skip to content

doc: add MDN links for explicit resource management in fs #59557

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

lluisemper
Copy link
Contributor

Add cross-references to MDN documentation for using and await using statements in the fs module documentation.

Remove TODO comment waiting for MDN documentation availability.

Fixes: #59556

@nodejs-github-bot nodejs-github-bot added doc Issues and PRs related to the documentations. fs Issues and PRs related to the fs subsystem / file system. labels Aug 20, 2025
doc/api/fs.md Outdated
@@ -874,6 +874,10 @@ changes:
Calls `filehandle.close()` and returns a promise that fulfills when the
filehandle is closed.

This method enables the filehandle to be used with [`await using`][], which
will automatically close the file when the scope exits. For more information,
see the [MDN documentation on `using` statements][].
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
see the [MDN documentation on `using` statements][].
see the [MDN documentation on `using` statements][`using`].

etc. to deduplicate the reference.

doc/api/fs.md Outdated
@@ -1342,10 +1346,11 @@ directory cannot be deleted, disposal will throw an error. The object has an
async `remove()` method which will perform the same task.

Both this function and the disposal function on the resulting object are
async, so it should be used with `await` + `await using` as in
async, so it should be used with [`await using`][] as in
Copy link
Contributor

Choose a reason for hiding this comment

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

The point of this comment was to signpost the fact that an initialisation requires both await and await using; the intent is lost with this removal.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I see your point, this syntax can be weird. I will update it to the previous comment but with a link. So it is easier to understand and we still get the link to the docs.

doc/api/fs.md Outdated
@@ -1342,10 +1346,11 @@ directory cannot be deleted, disposal will throw an error. The object has an
async `remove()` method which will perform the same task.

Both this function and the disposal function on the resulting object are
async, so it should be used with `await` + `await using` as in
async, so it should be used with `await` + [`await using`] as in
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
async, so it should be used with `await` + [`await using`] as in
async, so it should be used with `await` + [`await using`][] as in

Add cross-references to MDN documentation for `using` and `await using`
statements in the fs module documentation.

Remove TODO comment waiting for MDN documentation availability.

Fixes: nodejs#59556
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc Issues and PRs related to the documentations. fs Issues and PRs related to the fs subsystem / file system.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update fs documentation with MDN links for explicit resource management
3 participants