diff --git a/README.md b/README.md index 131f5e3..79dca35 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,9 @@ console.log(bl.slice(3, 6).toString('ascii')) // 'def' console.log(bl.slice(3, 8).toString('ascii')) // 'defgh' console.log(bl.slice(5, 10).toString('ascii')) // 'fghij' +console.log(bl.indexOf('def')) // 3 +console.log(bl.indexOf('asdf')) // -1 + // or just use toString! console.log(bl.toString()) // 'abcdefghij\u0003\u0004' console.log(bl.toString('ascii', 3, 8)) // 'defgh' @@ -86,6 +89,7 @@ bl.pipe(fs.createWriteStream('gibberish.txt')) * bl.length * bl.append(buffer) * bl.get(index) + * bl.indexOf(value[, byteOffset][, encoding]) * bl.slice([ start[, end ] ]) * bl.shallowSlice([ start[, end ] ]) * bl.copy(dest, [ destStart, [ srcStart [, srcEnd ] ] ]) @@ -129,6 +133,12 @@ Get the length of the list in bytes. This is the sum of the lengths of all of th ### bl.get(index) `get()` will return the byte at the specified index. +-------------------------------------------------------- + +### bl.indexOf(value[, byteOffset][, encoding]) +`get()` will return the byte at the specified index. +`indexOf()` method returns the first index at which a given element can be found in the BufferList, or -1 if it is not present. + -------------------------------------------------------- ### bl.slice([ start, [ end ] ])