You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've played around with this a little and i think fd and buffer are needed to keep the implementation simpler, but the other values can be optional. Similar to the fs.write and fs.writev
I'll get an error because at the moment, the callback is going into the buffer value. It seems like the implementation might be simplier and less error prone if the only optional values were offset, length and position. I'm going to give that a try
I have something working here: b139697 still using the default params(except for the callback). It is doing a little more typeof checking than i think is needed
I'll give the spread stuff a shot and see how that goes
i'm not a performance expert, so i don't if this is an issue, but it seem like creating that an extra default buffer if we didn't need to might affect something? Maybe not making buffer optional might be a good thing? 🤷♂️
I'll send a PR in the next day or so for more discussion
Activity
ronag commentedon Jan 7, 2020
Good first issue?
lholmquist commentedon Jan 15, 2020
@ronag I'd be willing to help out on this one. Just might need a little guidance to get started :)
lholmquist commentedon Jan 16, 2020
I've played around with this a little and i think
fdandbufferare needed to keep the implementation simpler, but the other values can be optional. Similar to thefs.writeandfs.writevLink to my first pass commit: lholmquist@a012cdb
In my first round of testing, i create the function signature like this:
If i run this with an example like
I'll get an error because at the moment, the callback is going into the buffer value. It seems like the implementation might be simplier and less error prone if the only optional values were offset, length and position. I'm going to give that a try
ronag commentedon Jan 16, 2020
You can't use default parameters here since the last parameter is not optional. Instead you might have to do something like:
Will need to check the performance implications as well.
lholmquist commentedon Jan 16, 2020
I have something working here: b139697 still using the default params(except for the callback). It is doing a little more typeof checking than i think is needed
I'll give the spread stuff a shot and see how that goes
lholmquist commentedon Jan 16, 2020
i'm not a performance expert, so i don't if this is an issue, but it seem like creating that an extra default buffer if we didn't need to might affect something? Maybe not making buffer optional might be a good thing? 🤷♂️
I'll send a PR in the next day or so for more discussion
Thanks @ronag for the help
ronag commentedon Jan 16, 2020
It would only be created if no buffer is provided. Default parameters are evaluated lazylily as far as I know. Might be worth to confirm though.
lholmquist commentedon Jan 16, 2020
👍
feat: make fs.read params optional
fs: make fs.read params optional
fs: make fs.read params optional
fs: make fs.read params optional