1
|
[![Build Status](https://secure.travis-ci.org/soldair/node-buffer-indexof.png)](http://travis-ci.org/soldair/node-buffer-indexof)
|
2
|
|
3
|
|
4
|
buffer-indexof
|
5
|
===================
|
6
|
|
7
|
find the index of a buffer in a buffer. should behave like String.indexOf etc.
|
8
|
|
9
|
```js
|
10
|
|
11
|
var bindexOf = require('buffer-indexof');
|
12
|
|
13
|
var newLineBuffer = new Buffer("\n");
|
14
|
|
15
|
var b = new Buffer("hi\nho\nsilver");
|
16
|
|
17
|
|
18
|
bindexOf(b,newLineBuffer) === 2
|
19
|
|
20
|
// you can also start from index
|
21
|
|
22
|
bindexOf(b,newLineBuffer,3) === 5
|
23
|
|
24
|
// no match === -1
|
25
|
|
26
|
bindexOf(b,newLineBuffer,6) === -1
|
27
|
|
28
|
|
29
|
```
|
30
|
|
31
|
CHANGELOG
|
32
|
----------
|
33
|
|
34
|
- 1.0.0
|
35
|
- fixed issue finding multibyte needles in haystack. thanks @imulus
|
36
|
- 1.0.1
|
37
|
- fixed failing to find partial matches as pointed out by @bahaa-aidi in #2
|