News for hackers. Stuff that matters.
Re:fs.promises.readFile is 40% slower than fs.readFile by idbehold on Wednesday March 03, 2021 @05:41PM (#26335850)
I believe the difference here is that these newly introduced promise wrappers allow you to pass an AbortSignal instances to them. Wrapping the old callback style methods would not allow you to "abort" in the middle of reading a file. You could respond to a passed in AbortSignal instance in the simple `readFilePromise` function you provided by simply rejecting early, but it wouldn't free up the underlying file descriptor until after the entire file had been read.
Re:fs.promises.readFile is 40% slower than fs.readFile by idbehold on Thursday March 04, 2021 @09:39AM (#26342986)
Actually I was completely wrong. They added support for consuming an AbortSignal in the old callback style methods as well. Now I'm at a loss as to why they even have two different implementations instead of just doing something like:

    fs.promises.readFile = util.promisify(fs.readFile);