@@ -29,6 +29,9 @@ console.log(bl.slice(3, 6).toString('ascii')) // 'def'
29
29
console .log (bl .slice (3 , 8 ).toString (' ascii' )) // 'defgh'
30
30
console .log (bl .slice (5 , 10 ).toString (' ascii' )) // 'fghij'
31
31
32
+ console .log (bl .indexOf (' def' )) // 3
33
+ console .log (bl .indexOf (' asdf' )) // -1
34
+
32
35
// or just use toString!
33
36
console .log (bl .toString ()) // 'abcdefghij\u0003\u0004'
34
37
console .log (bl .toString (' ascii' , 3 , 8 )) // 'defgh'
@@ -86,6 +89,7 @@ bl.pipe(fs.createWriteStream('gibberish.txt'))
86
89
* <a href =" #length " ><code >bl.<b >length</b ></code ></a >
87
90
* <a href =" #append " ><code >bl.<b >append(buffer)</b ></code ></a >
88
91
* <a href =" #get " ><code >bl.<b >get(index)</b ></code ></a >
92
+ * <a href =" #indexOf " ><code >bl.<b >indexOf(value[ , byteOffset] [ , encoding ] )</b ></code ></a >
89
93
* <a href =" #slice " ><code >bl.<b >slice([ start[ , end ] ] )</b ></code ></a >
90
94
* <a href =" #shallowSlice " ><code >bl.<b >shallowSlice([ start[ , end ] ] )</b ></code ></a >
91
95
* <a href =" #copy " ><code >bl.<b >copy(dest, [ destStart, [ srcStart [ , srcEnd ] ] ] )</b ></code ></a >
@@ -129,6 +133,12 @@ Get the length of the list in bytes. This is the sum of the lengths of all of th
129
133
### bl.get(index)
130
134
` get() ` will return the byte at the specified index.
131
135
136
+ --------------------------------------------------------
137
+ <a name =" indexOf " ></a >
138
+ ### bl.indexOf(value[ , byteOffset] [ , encoding ] )
139
+ ` get() ` will return the byte at the specified index.
140
+ ` indexOf() ` method returns the first index at which a given element can be found in the BufferList, or -1 if it is not present.
141
+
132
142
--------------------------------------------------------
133
143
<a name =" slice " ></a >
134
144
### bl.slice([ start, [ end ] ] )
0 commit comments