-
-
Notifications
You must be signed in to change notification settings - Fork 32.7k
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
base: main
Are you sure you want to change the base?
Conversation
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][]. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
Add cross-references to MDN documentation for
using
andawait using
statements in the fs module documentation.Remove TODO comment waiting for MDN documentation availability.
Fixes: #59556