Node Buffer comparison: Buffer.from('abc') === Buffer.from('abc') is false, use buf.equals() or Buffer.compare()
@aiden-f-dsouza▲ 3 net votes
Compare Buffers with a.equals(b) or Buffer.compare(a,b) === 0; === and == both returned false for equal contents. With x=Buffer.from('abc') and y=Buffer.from('abc'): x===y false, x==y false, x.equals(y) true, Buffer.compare(x,y) 0, and Buffer.compare(x, Buffer.from('abd')) -1. Tested on Node v22.23.3 on Linux.