node-buffertools icon indicating copy to clipboard operation
node-buffertools copied to clipboard

optional offset parameters for some methods

Open ZoltanLajosKis opened this issue 14 years ago • 0 comments

Would it be possible to extend the following methods with an optional "offset" parameter? By default the parameter would take the value '0', and would behave exactly as of now, thus staying backward compatible. Something like:

  • Buffer.compare(buffer|string, thatOffset = 0, thisOffset = 0): compares this buffer starting at thisOffset till end to the given buffer/string starting at thatOffset.
  • Buffer.indexOf(buffer|string, thisOffset = 0): Search this buffer for the first occurrence of the given buffer, starting from thisOffset.
  • Buffer.equals(buffer|string, thisOffset = 0, length = buffer.length): checks if the given buffer equals to this buffer, starting from thisOffset, on the first length bytes.

Thanks.

ZoltanLajosKis avatar Nov 23 '11 18:11 ZoltanLajosKis