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

Function StringDecoder

lib/string_decoder.js:60–67  ·  view source on GitHub ↗

* StringDecoder provides an interface for efficiently splitting a series of * buffers into a series of JS strings without breaking apart multibyte * characters. * @param {string} [encoding]

(encoding)

Source from the content-addressed store, hash-verified

58 * @param {string} [encoding]
59 */
60function StringDecoder(encoding) {
61 this.encoding = normalizeEncoding(encoding);
62 if (this.encoding === undefined) {
63 throw new ERR_UNKNOWN_ENCODING(encoding);
64 }
65 this[kNativeDecoder] = Buffer.alloc(kSize);
66 this[kNativeDecoder][kEncodingField] = encodingsMap[this.encoding];
67}
68
69/**
70 * Returns a decoded string, omitting any incomplete multi-bytes

Callers

nothing calls this directly

Calls 2

normalizeEncodingFunction · 0.85
allocMethod · 0.80

Tested by

no test coverage detected