Node.js buffer equals() Method
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 »