diff --git a/lib/internal/fs/promises.js b/lib/internal/fs/promises.js index c93d89461ffa8a..960ea5492d5f8c 100644 --- a/lib/internal/fs/promises.js +++ b/lib/internal/fs/promises.js @@ -188,11 +188,8 @@ async function readFileHandle(filehandle, options) { } while (!endOfFile); const result = Buffer.concat(chunks); - if (options.encoding) { - return result.toString(options.encoding); - } else { - return result; - } + + return options.encoding ? result.toString(options.encoding) : result; } // All of the functions are defined as async in order to ensure that errors