-
Notifications
You must be signed in to change notification settings - Fork 776
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
Return Objects from fs.read & fs.write #436
Comments
This is due to the way our promisification logic works (or rather, doesn't work). The promise only returns let buf = Buffer.alloc(length)
let bytesread = await fs.read(fd, buf, 0, length, start)
// Use buf here The reason for this is that This is sub-optimal and should probably be fixed in the next major release. However, I'm thinking we should follow the lead of
|
Thanks! That works great, and having two references to the same buffer was redundant anyway. The typescript defs are still showing it returning [number, Buffer], but that's not an issue for this repo. |
Yeah, could submit a fix here: https://github.com/DefinitelyTyped/DefinitelyTyped |
The promisified version of fs.read shows up in the typescript typings, but when run gives "fs.read is not a function". I'm using the latest versions of both:
and calling as I would expect to:
The text was updated successfully, but these errors were encountered: