Tutorials References Exercises Videos Menu
Create Website Get Certified Upgrade

Node.js buffer entries() Method

❮ Buffer Module


Example

Display the content of a Buffer, both index and byte:

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

for (x of buf.entries()) {
  console.log(x);
}
Run example »

Definition and Usage

The entries() method returns an iterator object, containing the index and byte value of each byte in a buffer object.


Syntax

buffer.entries();

Technical Details

Return Value: An iterator object containing an index-byte array for each byte in a Buffer object
Node.js Version: 1.1.0

❮ Buffer Module