Content-Length: 10328 | pFad | https://nodejs.org/docs/latest-v0.12.x/api/string_decoder.html

StringDecoder Node.js v0.12.18 Manual & Documentation

Node.js v0.12.18 Manual & Documentation


StringDecoder#

Stability: 3 - Stable

To use this module, do require('string_decoder'). StringDecoder decodes a buffer to a string. It is a simple interface to buffer.toString() but provides additional support for utf8.

var StringDecoder = require('string_decoder').StringDecoder;
var decoder = new StringDecoder('utf8');

var cent = new Buffer([0xC2, 0xA2]);
console.log(decoder.write(cent));

var euro = new Buffer([0xE2, 0x82, 0xAC]);
console.log(decoder.write(euro));

Class: StringDecoder#

Accepts a single argument, encoding which defaults to utf8.

decoder.write(buffer)#

Returns a decoded string.

decoder.end()#

Returns any trailing bytes that were left in the buffer.









ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://nodejs.org/docs/latest-v0.12.x/api/string_decoder.html

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy