There are lots of Buffer.from(value, ENC).toString(ENC_2) code duplication in Node. I recommend creating a C++ function to do the same execution with less JS/C++ calls. bufferToString(value, encoding_1, encoding_2); that returns a string.
For example:
- buffer.js - btoa -
Buffer.from(input, 'latin1').toString('base64');
- buffer.js - atob -
Buffer.from(input, 'base64').toString('latin1')
- _http_client.js -
Buffer.from(options.auth).toString('base64')
- random.js -
Buffer.from(arrayBuffer).toString('hex')