GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — doc: clarify fd behaviour with {read,write}File by thefourtheye · Pull Request #23706 · nodejs/node Conversation
Contributor
Checklist
Ref: #23433 (comment) cc @nodejs/fs @nodejs/documentation @Trott
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Collaborator
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
addaleax
approved these changes
lpinca
approved these changes
vsemozhetbyt
approved these changes
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. With nit suggestions.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit:
Suggested change
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This seems a bit confusing as
Suggested change
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Contributor
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
Contributor
Author
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
trivikr
approved these changes
Contributor
Author
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe this line can be omitted as self-evident.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
|
There was an error while loading. Please reload this page.
|
I am in doubt for these fragments of write counterparts:
This may be true only if the current position is the end of the file or the newly written data is less then the old rewritten data. Say, we have |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@vsemozhetbyt Once #23709 lands, the behaviour will become like this ➜ node git:(fix-fs-writeFile-with-fd) echo "Hello World" > /tmp/test ➜ node git:(fix-fs-writeFile-with-fd) cat ~/Desktop/Scratch/Test.js 'use strict'; const fs = require('fs'); const fileName = '/tmp/test'; const fd = fs.openSync(fileName, 'w'); fs.writeFile(fd, 'Hello', function(err) { if (err) { throw err; } fs.writeFile(fd, 'World', function(err) { if (err) { throw err; } console.log(fs.readFileSync(fileName).toString()); }); }); ➜ node git:(fix-fs-writeFile-with-fd) ./node ~/Desktop/Scratch/Test.js
HelloWorld
➜ node git:(fix-fs-writeFile-with-fd)Even if the file has contents, the first write will always truncate the file. So, it will always seem like appending only. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
CI-lite: https://ci.nodejs.org/job/node-test-pull-request-lite-pipeline/1316/ |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| 1. Any specified file descriptor has to support reading. | ||
| 2. If a file descriptor is specified as the `path`, it will not be closed | ||
| automatically. | ||
| 3. The reading will begin at the current position. If the file size is |
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Clarify that the If ... is an example?
Something like E.g., if ... or For example, if ....
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Ack.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
|
||
| The `FileHandle` has to support reading. | ||
|
|
||
| **Note:** If one or more `filehandle.read()` calls are made on a file handle |
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
We deliberately don't use **Note:** anymore afaik?
See #18592.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
It's not official, but there has definitely been an effort to use it much less. In this case, I think It can be dropped and you can just say what you have to say:
If one or more `filehandle.read()` calls are made on a file handle
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Makes sense. I removed the Note now.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| It is unsafe to use `filehandle.writeFile()` multiple times on the same file | ||
| without waiting for the `Promise` to be resolved (or rejected). | ||
|
|
||
| **Note:** If one or more `filehandle.write()` calls are made on a file handle |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Ditto.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Ack
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
LGTM with nits.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
LGTM once comments are addressed.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
This reverts commit b5a440c.
|
I reverted the changes necessary for #23709 and addressed the review comments. Reviewers, PTAL again. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I'll land this by 31 October 2018, 07:30:00 (UTC time), if there are no objections or suggestions. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Lite CI: https://ci.nodejs.org/job/node-test-pull-request-lite-pipeline/1368/ |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Landed in 8bd6df8. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
PR-URL: #23706 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Vse Mozhet Byt <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Сковорода Никита Андреевич <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
PR-URL: #23706 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Vse Mozhet Byt <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Сковорода Никита Андреевич <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
PR-URL: #23706 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Vse Mozhet Byt <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Сковорода Никита Андреевич <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
PR-URL: #23706 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Vse Mozhet Byt <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Сковорода Никита Андреевич <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
PR-URL: #23706 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Vse Mozhet Byt <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Сковорода Никита Андреевич <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.