Sitelet https://github.com/nodejs/node/issues/95
Skip to content

feature: Buffer.prototype.indexOf #95

Description

@srijs

This has been nagging me for a while, wanting to efficiently search a buffer for a sub-string/buffer, similar to memchr/memcmp, joining Array.prototype.indexOf and String.prototype.indexOf.

I finally got around to implement it as a native module: buffer-indexof-fast (on npm and github). The semantics are 100% compatible to String.prototype.indexOf.

I know there is some discussion going on in terms of what to put into core and what not, but I figured since Buffers are such a fundamental means of sharing information, especially also with the "core", I'll just as the following question...

Would you like to have such a functionality in node-buffers? I would be open to do the work necessary to get it cleaned up and match the code quality of core, if it shows that there is the demand for it.

Activity

  1. vkurchatkin commented on Dec 6, 2014

    @vkurchatkin
    Contributor

    +1, also everything else from %TypedArray%.prototype

  2. bnoordhuis commented on Dec 6, 2014

    @bnoordhuis
    Member

    .indexOf() and .lastIndexOf() seem unobjectionable to me. PR welcome!

  3. indutny commented on Dec 7, 2014

    @indutny
    Member

    +1

  4. benjamingr commented on Dec 7, 2014

    @benjamingr
    Member

    +1 for this, definitely something I needed before and didn't have.

  5. feross commented on Dec 7, 2014

    @feross
    Contributor

    +1.

    @srijs After your PR is accepted here, if you're feeling ambitious, please also send a PR to the npm module buffer so browserify users can use the new API too!

  6. indutny commented on Dec 8, 2014

    @indutny
    Member

    Summoning @caineio

  7. juliangruber commented on Dec 8, 2014

    @juliangruber
    Member
    1. yes
    2. buffer
    3. v0.12
  8. zeusdeux commented on Dec 10, 2014

    @zeusdeux
    Contributor

    👍

  9. a8m commented on Dec 13, 2014

    @a8m

    +1, also for .lastIndexOf()

  10. srijs commented on Dec 14, 2014

    @srijs
    Author

    PR: #160

  11. added
    bufferIssues and PRs related to the buffer subsystem.
    on Jan 23, 2015
  12. brendanashworth commented on Mar 5, 2015

    @brendanashworth
    Contributor

    Closing as #561 was merged.

  13. added a commit that references this issue on Apr 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bufferIssues and PRs related to the buffer subsystem.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions