diff --git a/lib/internal/streams/utils.js b/lib/internal/streams/utils.js index 7904b4a66d1dec..44ca7703a82fb2 100644 --- a/lib/internal/streams/utils.js +++ b/lib/internal/streams/utils.js @@ -278,7 +278,7 @@ function isErrored(stream) { function encodeWithFastPath(input, encoding) { const enc = normalizeEncoding(encoding); - if (enc === 'utf8') { + if (enc === 'utf8' && TypedArrayPrototypeGetByteLength(input) > 512) { const buf = encoder.encode(input); return new FastBuffer( TypedArrayPrototypeGetBuffer(buf),