Tutorials References Exercises Videos Menu
Create Website Get Certified Upgrade

Node.js buffer keys() Method

❮ Buffer Module


Example

Display the keys (indexes) of a Buffer object:

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

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

Definition and Usage

The keys() method returns an iterator object, containing the key of each byte in a buffer object.


Syntax

buffer.keys();

Technical Details

Return Value: An Iterator object, containing the keys of a buffer
Node.js Version: 1.1.0

❮ Buffer Module