Javatpoint Logo
Javatpoint Logo

Node.js StringDecoder

The Node.js StringDecoder is used to decode buffer into string. It is similar to buffer.toString() but provides extra support to UTF.

You need to use require('string_decoder') to use StringDecoder module.

Node.js StringDecoder Methods

StringDecoder class has two methods only.

Method Description
decoder.write(buffer) It is used to return the decoded string.
decoder.end() It is used to return trailing bytes, if any left in the buffer.

Node.js StringDecoder Example

Let's see a simple example of Node.js StringDecoder.

File: stringdecoder_example1.js

Node.js stringdecoder example 1




Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA