Menu
×
   ❮     
HTML CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C C++ C# BOOTSTRAP REACT MYSQL JQUERY EXCEL XML DJANGO NUMPY PANDAS NODEJS R TYPESCRIPT ANGULAR GIT POSTGRESQL MONGODB ASP AI GO KOTLIN SASS VUE DSA GEN AI SCIPY CYBERSECURITY DATA SCIENCE
     ❯   

Node.js buffer equals() Method

❮ Buffer Module


Example

Compare two buffer objects:

var buf1 = Buffer.from('abc');
var buf2 = Buffer.from('abc');

console.log(buf1.equals(buf2));
Run example »

Definition and Usage

The equals() method compares two buffer objects and returns true if they are equal, otherwise false.


Syntax

buffer.equals(buf);

Parameter Values

Parameter Description
buf Required. A buffer to compare with

Technical Details

Return Value: A Boolean
Node.js Version: 0.11.13

More Examples

Example

Compare two buffer objects:

var buf1 = Buffer.from('abc');
var buf2 = Buffer.from('abcd');

console.log(buf1.equals(buf2);
Run example »

❮ Buffer Module