Node.js Buffer.isBuffer() Method

❮ Buffer Module


Example

Check if an object is a Buffer:

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

console.log(Buffer.isBuffer(x));
Run example »

Definition and Usage

The Buffer.isBuffer() method returns true if the specified object is a Buffer, otherwise false.


Syntax

Buffer.isBuffer(obj);

Parameter Values

Parameter Description
obj Required. The object to check if is a Buffer

Technical Details

Return Value: A Boolean, true if the specified object is a Buffer, otherwise false
Node.js Version: 0.1.101

More Examples

Example

Check if an object is a Buffer:

var x = 'abc';

console.log(Buffer.isBuffer(x));
Run example »

❮ Buffer Module

Copyright 1999-2023 by Refsnes Data. All Rights Reserved.