Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

std/node/_buffer.d.ts>Buffer#values

Deno standard library
Go to Latest
The Standard Library has been moved to JSR. See the blog post for details.
method Buffer.prototype.values
import { Buffer } from "https://deno.land/std@0.125.0/node/_buffer.d.ts";

Creates and returns an iterator for buf values (bytes). This function is called automatically when a Buffer is used in a for..of statement.

import { Buffer } from 'buffer';

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

for (const value of buf.values()) {
  console.log(value);
}
// Prints:
//   98
//   117
//   102
//   102
//   101
//   114

for (const value of buf) {
  console.log(value);
}
// Prints:
//   98
//   117
//   102
//   102
//   101
//   114

Returns

IterableIterator<number>