Tutorials References Exercises Menu
Paid Courses

Node.js buffer includes() Method

❮ Buffer Module


Check if a buffer incudes the phrase "welcome":

var buf = Buffer.from('Hello, and welcome to Rome!');

Run example »

Definition and Usage

The includes() method checks if a specified value is included in the buffer.

Returns true if the values is included, otherwise false.


buffer.includes(value, start, encoding);

Parameter Values

Parameter Description
value Required. What to search for. Legal value types:
Number (Integer)
start Optional. Where to begin the search. Default 0
encoding Optional. If the value is a string, this parameter is used to specify its encoding. Default "utf8"

Technical Details

Return Value: A Boolean
Node.js Version: 5.3.0

❮ Buffer Module