buf.includes()
buf.includes(value[, byteOffset][, encoding])
- value {String} | {Buffer} | {Number}
- byteOffset {Number} 默认:0
- encoding {String} 默认:'utf8'
- 返回:{Boolean}
buf.includes('this');
// returns true
buf.includes('is');
// returns true
buf.includes(Buffer.from('a buffer'));
// returns true
buf.includes(97); // ascii for 'a'
// returns true
buf.includes(Buffer.from('a buffer example'));
// returns false
buf.includes(Buffer.from('a buffer example').slice(0, 8));
// returns true
buf.includes('this', 4);
// returns false