Last change
on this file since 6a3a178 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
729 bytes
|
Rev | Line | |
---|
[6a3a178] | 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
|
---|
Note:
See
TracBrowser
for help on using the repository browser.