Node.js String Decoder Module
ตัวอย่าง
ถอดรหัสกระแสข้อมูลไบนารี (วัตถุบัฟเฟอร์) เป็นสตริง:
var StringDecoder = require('string_decoder').StringDecoder;
var d = new
StringDecoder('utf8');
var b = Buffer('abc');
console.log(b);
//write buffer
console.log(d.write(b)); // write decoded buffer;
ความหมายและการใช้งาน
โมดูลตัวถอดรหัสสตริงให้วิธีการถอดรหัสวัตถุบัฟเฟอร์เป็นสตริง
ไวยากรณ์
ไวยากรณ์สำหรับการรวมโมดูลตัวถอดรหัสสตริงในแอปพลิเคชันของคุณ:
var StringDecoder = require('string_decoder').StringDecoder;
คุณสมบัติและเมธอดของตัวถอดรหัสสตริง
Method | Description |
---|---|
end() | Returns what remains of the input stored in the internal buffer |
write() | Returns the specified buffer as a string |