-
-
Notifications
You must be signed in to change notification settings - Fork 31.5k
fs: promises have undocumented write(string,…) method #20406
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
Not sure if this is a documentation issue. Should we keep that API in such form? |
Without looking into it further: as far as I know the promises API should be identical to the non-promise one besides returning promises. So it sounds like a documentation issue. |
Refs: #18297 (comment) and next comment:
so cc @jasnell |
It's undocumented, but present and partially broken — see #20407. |
Note that according to coverage report, that variant is called once, which means that there is a test that depends on it being present. |
Doc omission. The variant should be doc'd. |
It was a to-do that I never went back to. Although if I recall correctly there may need to be some reconcilation still with the non-promise version |
@BridgeAR ... To be certain the promise certain is not identical. There are intended differences... Such as the use of the FileHandle object rather than numeric fd. |
That does not sound intuitive to me at all. I would have expected it is fine to switch to promises 1-to-1. Can you outline the specific differences / where there a lot of these? |
@BridgeAR The ones I noticed:
Example: > await (await fsp.open('test.txt', 'w')).write('test')
{ bytesWritten: 4, buffer: 'test' }
> fs.writeSync(fs.openSync('test.txt', 'w'), 'test')
4 |
@ChALkeR thanks for pointing these things out. |
@BridgeAR I actually think that we could merge |
Big -1 on merging the APIs. Polymorphic returns are awful and it's not something we can do consistently across the core API. fs.promises should remain a separate API path. |
@jasnell - Currently, the implementation of |
@nodejs/collaborators 👍 for good-first-issue (doc omission for |
Add missing docs for filehandle.write(string[, position[, encoding]]) In the fs.promises API. fixes: nodejs#20406
Add missing docs for filehandle.write(string[, position[, encoding]]) In the fs.promises API. Fixes: nodejs#20406 PR-URL: nodejs#23224 Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Non-promises API has two variants documented: Buffer, string.
Promises API has only Buffer variants documented: method, class method.
This code works, but it's undocumented behavior:
The text was updated successfully, but these errors were encountered: