Unverified Commit 44ef458d authored by Unknown's avatar Unknown Committed by Anna Henningsen
Browse files

fs: ensure options.flag defaults to 'r' in readFile

When passing {} or { encoding: 'utf8' } as options to readFile, the
flag is not defaulted to 'r' unlike normal fs. This fix makes
fs.promises.readFile() act consistent with fs.readFile().

It also fixes another issue with fs.promises.readfile() where it
returned a Buffer instead of an empty string when encoding is provided.

PR-URL: https://github.com/nodejs/node/pull/20268


Reviewed-By: default avatarJames M Snell <jasnell@gmail.com>
Reviewed-By: default avatarRon Korving <ron@ronkorving.nl>
Reviewed-By: default avatarTrivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: default avatarRuben Bridgewater <ruben@bridgewater.de>
parent 04af6975
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment