Just use Buffer#includes()
. It has been available since Node.js 6.
Node.js
buffer.includes()
ponyfill
$ npm install --save buffer-includes
const bufferIncludes = require('buffer-includes');
bufferIncludes(new Buffer('unicorn'), 'corn');
//=> true
See the buffer.includes()
docs for more details.
- buf-indexof - Node.js
buffer.indexOf()
ponyfill - buffer-equals - Node.js
buffer.equals()
ponyfill - buf-compare - Node.js
Buffer.compare()
ponyfill
MIT © Sindre Sorhus