(string, encoding)
| 510 | } |
| 511 | |
| 512 | function 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 | |
| 525 | function fromArrayBuffer(obj, byteOffset, length) { |
| 526 | // Convert byteOffset to integer |
no test coverage detected
searching dependent graphs…