We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c21c51a commit d91ef15Copy full SHA for d91ef15
1 file changed
doc/api/string_decoder.markdown
@@ -0,0 +1,24 @@
1
+# StringDecoder
2
+
3
+ Stability: 2 - Unstable
4
5
+To use this module, do `require('string_decoder')`. StringDecoder decodes a
6
+buffer to a string. It is a simple interface to `buffer.toString()` but provides
7
+additional support for utf8.
8
9
+ var StringDecoder = require('string_decoder').StringDecoder;
10
+ var decoder = new StringDecoder('utf8');
11
12
+ var cent = new Buffer([0xC2, 0xA2]);
13
+ console.log(decoder.write(cent));
14
15
+ var euro = new Buffer([0xE2, 0x82, 0xAC]);
16
+ console.log(decoder.write(euro));
17
18
+## Class: StringDecoder
19
20
+Accepts a single argument, `encoding` which defaults to `utf8`.
21
22
+### StringDecoder.write(buffer)
23
24
+Returns a decoded string.
0 commit comments