MCPcopy Index your code
hub / github.com/nodejs/node / toBuf

Function toBuf

lib/internal/crypto/util.js:104–111  ·  view source on GitHub ↗
(val, encoding)

Source from the content-addressed store, hash-verified

102// any explicit encoding in older versions of node, and we don't want
103// to break them unnecessarily.
104function toBuf(val, encoding) {
105 if (typeof val === 'string') {
106 if (encoding === 'buffer')
107 encoding = 'utf8';
108 return Buffer.from(val, encoding);
109 }
110 return val;
111}
112
113let _hashCache;
114function getHashCache() {

Callers 4

util.jsFile · 0.85
DiffieHellmanFunction · 0.85
prepareKeyFunction · 0.85
configSecureContextFunction · 0.85

Calls 1

fromMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…