{ "source": "doc/api/string_decoder.markdown", "modules": [ { "textRaw": "StringDecoder", "name": "stringdecoder", "stability": 3, "stabilityText": "Stable", "desc": "
To use this module, do require('string_decoder')
. StringDecoder decodes a\nbuffer to a string. It is a simple interface to buffer.toString()
but provides\nadditional support for utf8.\n\n
var StringDecoder = require('string_decoder').StringDecoder;\nvar decoder = new StringDecoder('utf8');\n\nvar cent = new Buffer([0xC2, 0xA2]);\nconsole.log(decoder.write(cent));\n\nvar euro = new Buffer([0xE2, 0x82, 0xAC]);\nconsole.log(decoder.write(euro));
\n",
"classes": [
{
"textRaw": "Class: StringDecoder",
"type": "class",
"name": "StringDecoder",
"desc": "Accepts a single argument, encoding
which defaults to utf8
.\n\n
Returns a decoded string.\n\n
\n", "signatures": [ { "params": [ { "name": "buffer" } ] } ] }, { "textRaw": "decoder.end()", "type": "method", "name": "end", "desc": "Returns any trailing bytes that were left in the buffer.\n
\n", "signatures": [ { "params": [] } ] } ] } ], "type": "module", "displayName": "StringDecoder" } ] }