Buffer

Buffer.isBuffer()

Distinguishes Node Buffer instances from ordinary typed arrays and other values. Tested on Node.js 22.16.0. Use it only when the Buffer-specific interface matters; Uint8Array is also valid for many APIs.

Formal Syntax & Structure

nodejs syntaxnodejs
Buffer.isBuffer(obj)

Parameters & Attributes

NameTypeDescription
objanyValue to inspect.

Return Value

boolean

True for Buffer instances.

Working Example

Example Snippetnodejs
import { Buffer } from 'node:buffer';console.log(Buffer.isBuffer(Buffer.alloc(1)), Buffer.isBuffer(new Uint8Array(1)));
Node.js Reference