Skip to main content
Module

std/node/buffer.ts>Buffer#keys

Deno standard library
Go to Latest
method Buffer.prototype.keys
import { Buffer } from "https://deno.land/std@0.167.0/node/buffer.ts";

Creates and returns an iterator of buf keys (indices).

import { Buffer } from 'buffer';

const buf = Buffer.from('buffer');

for (const key of buf.keys()) {
  console.log(key);
}
// Prints:
//   0
//   1
//   2
//   3
//   4
//   5

Returns

IterableIterator<number>