Skip to content

Commit

Permalink
doc: add print results for examples in StringDecoder
Browse files Browse the repository at this point in the history
PR-URL: #49326
Refs: #49143
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Deokjin Kim <deokjin81.kim@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
  • Loading branch information
pluris committed Aug 27, 2023
1 parent 5a07777 commit b9153af
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions doc/api/string_decoder.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ const { StringDecoder } = require('node:string_decoder');
const decoder = new StringDecoder('utf8');

const cent = Buffer.from([0xC2, 0xA2]);
console.log(decoder.write(cent));
console.log(decoder.write(cent)); // Prints: ¢

const euro = Buffer.from([0xE2, 0x82, 0xAC]);
console.log(decoder.write(euro));
console.log(decoder.write(euro)); // Prints: €
```

When a `Buffer` instance is written to the `StringDecoder` instance, an
Expand All @@ -41,7 +41,7 @@ const decoder = new StringDecoder('utf8');

decoder.write(Buffer.from([0xE2]));
decoder.write(Buffer.from([0x82]));
console.log(decoder.end(Buffer.from([0xAC])));
console.log(decoder.end(Buffer.from([0xAC]))); // Prints: €
```

## Class: `StringDecoder`
Expand Down

0 comments on commit b9153af

Please sign in to comment.