Ryan Zimmerman

Results 239 comments of Ryan Zimmerman

:man_facepalming: I feel silly; I did know that, but I somehow forgot about it when I replied.

Huh, these weird cases. What's the result of calling `fs.mkdir` with a newline in the filename? (when the parent directories exist)

No wonder it crashes. `ENOENT` is also the error code we get when the parent doesn't exist, so we respond by trying to create the parent. That causes an infinite...

@manidlou That's the ugly part. AFAIK, on Windows, newlines aren't allowed. However, they may be allowed on some Linux systems, not sure. We could either error out on a newline,...

@wrager I'm leaning in that direction as well. If only Windoze would throw a sensible error for invalid characters instead of `ENOENT`... :grimacing:

@manidlou Yeah, we probably should. That's gonna be messy, though. I didn't think about that.

Well, hopefully https://github.com/nodejs/node/pull/21875 solves this for newer Node versions.

@jprichardson This inconsistency is actually documented: https://github.com/jprichardson/node-jsonfile#readfilefilename-options-callback Do you know why you built it this way?

So it seems `throws` was built for sync, because it's a pain to stop sync errors. It was added to async because someone didn't want to have to check if...