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

Function fromString

lib/buffer.js:512–523  ·  view source on GitHub ↗
(string, encoding)

Source from the content-addressed store, hash-verified

510}
511
512function fromString(string, encoding) {
513 let ops;
514 if (!encoding || encoding === 'utf8' || typeof encoding !== 'string') {
515 ops = encodingOps.utf8;
516 } else {
517 ops = getEncodingOps(encoding);
518 if (ops === undefined)
519 throw new ERR_UNKNOWN_ENCODING(encoding);
520 }
521
522 return string.length === 0 ? new FastBuffer() : fromStringFast(string, ops);
523}
524
525function fromArrayBuffer(obj, byteOffset, length) {
526 // Convert byteOffset to integer

Callers 1

buffer.jsFile · 0.70

Calls 2

getEncodingOpsFunction · 0.85
fromStringFastFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…