Closed giper45 closed 7 years ago
I don't see the point of this, since this is how the native fs.readFile()
method works. The reasoning is that an incorrect type is a programmer error, not a app runtime error.
See https://runkit.com/57ebc041d4a27f140028fd78/59022f55acedf10011cce7ae
Using jsonfile in my project, I found that in read file if you try to send a null filename it doesn't return an error but throw an exception that exit from app. More precisely it is an fs issue / choice, anyway it wouldn't better if jsonfile returns an error from callback if null input filename is sent?
Here the test :
A solution could be the following:
Simply add
file = file || '' when readFile starts
Thanks !