From 99de2564da20f0aaac1e8a61a940323daaf16a42 Mon Sep 17 00:00:00 2001 From: "soda.wang" Date: Sun, 24 Dec 2017 19:52:25 +0800 Subject: [PATCH] section: io, supplement of StringDecoder --- sections/zh-cn/io.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sections/zh-cn/io.md b/sections/zh-cn/io.md index 74240f2..2f4ae0a 100644 --- a/sections/zh-cn/io.md +++ b/sections/zh-cn/io.md @@ -65,7 +65,7 @@ const euro = Buffer.from([0xE2, 0x82, 0xAC]); console.log(decoder.write(euro)); // € ``` -当然也可以断断续续的处理. +stringDecoder.write 会确保返回的字符串不包含 Buffer 末尾残缺的多字节字符,残缺的多字节字符会被保存在一个内部的 buffer 中用于下次调用 stringDecoder.write() 或 stringDecoder.end()。 ```javascript const StringDecoder = require('string_decoder').StringDecoder;