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
Considering the code above, the readFile has 2 parameters: the url and the options.
In theory, the parameter options is default to {encoding:null, flag:'r'}.
The problem is that the flag won't be default if I run this with electron-webpack. But working if I run the code with node (and with babel of course). So with electron-webpack I get an exception:
NodeError: The value "undefined" is invalid for option "flags"
at stringToFlags (internal/fs/utils.js:253:9)
at open (internal/fs/promises.js:198:34)
at Object.readFile (internal/fs/promises.js:466:20)
...
The stack trace doesn't tell so much but there's a function in promises.js:
I tested and the getOptions(options, { flag: 'r' }) is giving back the options without modifications. Which is right because of the definition of getOptions:
Introduction
The fs library of node provides an experimental feature: the fs/promises which has the same functionality but with promises.
The bug
Considering the code above, the readFile has 2 parameters: the
url
and theoptions
.In theory, the parameter
options
is default to{encoding:null, flag:'r'}
.The problem is that the flag won't be default if I run this with electron-webpack. But working if I run the code with node (and with babel of course). So with electron-webpack I get an exception:
The stack trace doesn't tell so much but there's a function in
promises.js
:I tested and the getOptions(options, { flag: 'r' }) is giving back the options without modifications. Which is right because of the definition of getOptions:
By then, I don't really understand why is it working without electron-webpack. But the node documentation says it is correct to give object into the
options
.https://nodejs.org/api/fs.html#fs_fspromises_readfile_path_options
Possible workaround
The text was updated successfully, but these errors were encountered: