Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
crypto: do not overwrite _writableState.defaultEncoding
This only affects the writable side of LazyTransform and should not change the behavior of any LazyTransform streams (Cipher, Decipher, Cipheriv, Decipheriv, Hash, Hmac). If the user does not set defaultEncoding when creating a transform stream, WritableState uses 'utf8' by default. Only LazyTransform overwrites this with the return value of getDefaultEncoding(). This was necessary when crypto.DEFAULT_ENCODING still existed. Now that DEFAULT_ENCODING has been removed, getDefaultEncoding() always returns 'buffer'. The writable side of LazyTransform appears to treat 'utf8' and 'buffer' in exactly the same way. Therefore, there seems to be no need to overwrite _writableState.defaultEncoding at this point. Nevertheless, because Node.js has failed to hide implementation details such as _writableState from the ecosystem, we may want to consider this a breaking change. Refs: #47182 Refs: #8611
- Loading branch information