Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/deno/ext/node/polyfills/buffer.ts>Buffer#entries

A modern runtime for JavaScript and TypeScript.
Go to Latest
method Buffer.prototype.entries
import { Buffer } from "https://deno.land/x/deno@v1.39.0/ext/node/polyfills/buffer.ts";

Creates and returns an iterator of [index, byte] pairs from the contents of buf.

import { Buffer } from "ext:deno_node/internal/buffer";

// Log the entire contents of a `Buffer`.

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

for (const pair of buf.entries()) {
  console.log(pair);
}
// Prints:
//   [0, 98]
//   [1, 117]
//   [2, 102]
//   [3, 102]
//   [4, 101]
//   [5, 114]

Returns

IterableIterator<[number, number]>