Skip to content

Latest commit

 

History

History
22 lines (15 loc) · 465 Bytes

File metadata and controls

22 lines (15 loc) · 465 Bytes
description
Native Node.js alternatives to the buffer-equal package for buffer equality checks

Replacements for buffer-equal

Buffer#equals (native)

Buffers have an equals method since Node 0.12.

Example:

import { Buffer } from 'node:buffer'
import bufferEqual from 'buffer-equal' // [!code --]

const buf1 = Buffer.from('303')
const buf2 = Buffer.from('303')

bufferEqual(buf1, buf2) // [!code --]
buf1.equals(buf2) // [!code ++]