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
Throws: TypeError: flags must be an int from native land.
While on the C++ side, that may be correct, in JavaScript land, the 2nd argument is not an int but a string.
In other words, yes, me passing an object was bad, but the error informed me to do the wrong thing compared to what the docs say.
I think it should throw a TypeError if not string and not integer (Number.isInteger is now at our disposal). However, this is also used in the asynchronous fs.open, so we need to be careful with exceptions.
In fact, I just realized that's already broken in fs.open and fs.readFile, since stringToFlags already throws. See Line 251 and Line 541.
Activity
reqshark commentedon Sep 15, 2015
fsflags are a string, not object, like goingrequire('fs').readFile(dude, 'utf8', cb)reqshark commentedon Sep 15, 2015
but yea the error definitely says
intwhen you give it objectsyjhjstz commentedon Sep 15, 2015
should we throw
new Error('Unknown file open flag: ' + flag);instringToFlags?ronkorving commentedon Sep 15, 2015
I think it should throw a
TypeErrorif not string and not integer (Number.isIntegeris now at our disposal). However, this is also used in the asynchronousfs.open, so we need to be careful with exceptions.In fact, I just realized that's already broken in
fs.openandfs.readFile, sincestringToFlagsalready throws. See Line 251 and Line 541.ronkorving commentedon Sep 15, 2015
I'll conjure up a PR to fix this.
jasnell commentedon Mar 9, 2016
Fixed by #5590