Tutorials References Exercises Videos Menu
Create Website Get Certified Upgrade

Node.js buffer toString() Method

❮ Buffer Module


Example

Display the buffer object as a string:

var buf = Buffer.from('abc');

console.log(buf.toString());
Run example »

Definition and Usage

The toString() method returns the buffer object according to the specified encoding.


Syntax

buffer.toString(encoding, start, end);

Parameter Values

Parameter Description
encoding Optional. The encoding to use in the return value. Default 'utf8'
start Optional. Where to start. Default 0
end Optional. Where to end. Default at the very end of the buffer

 Technical Details

Return Value: A Buffer
Node.js Version: 0.1.90

❮ Buffer Module