Skip to content

doc: Buffer.prototype.byteLength is undocumented聽#34946

Description

@silverwind

馃摋 API Reference Docs Problem

  • Subsystem: buffer

Location

Affected URL(s):

Description

Buffer instances have a undocumented .byteLength property. We should document it. Docs only exist for the static method Buffer.byteLength but not for Buffer.prototype.byteLength.

> Buffer.from("馃摋").byteLength
4

  • I would like to work on this issue and submit a pull request.

Activity

  1. added
    bufferIssues and PRs related to the buffer subsystem.
    docIssues and PRs related to Node.js documentation.
    good first issueIssues that are suitable for first-time contributors.
    on Aug 27, 2020
  2. mscdex commented on Aug 27, 2020

    @mscdex
    Contributor

    I believe that's because it's inherited from TypedArray.

  3. PoojaDurgad commented on Aug 27, 2020

    @PoojaDurgad
    Contributor

    I would like to work on this issue and submit a pull request.

  4. PoojaDurgad commented on Aug 27, 2020

    @PoojaDurgad
    Contributor

    @silverwind Can I document property under buffer class

  5. silverwind commented on Aug 27, 2020

    @silverwind
    ContributorAuthor

    @mscdex isn't it coming from ArrayBuffer#byteLength?

    @PoojaDurgad Let's first get clearance whether we document inherited properties or not. Once that is decided, I'd suggest adding it below the buf.buffer prototype method, possibly with just a link to MDN.

  6. mscdex commented on Aug 27, 2020

    @mscdex
    Contributor

    @silverwind Not necessarily. If the Buffer/Uint8Array is a subset of the backing ArrayBuffer, then the subset length will be returned and not the ArrayBuffer length.

  7. silverwind commented on Aug 27, 2020

    @silverwind
    ContributorAuthor

    Removing Good first issue for now as it's not as trivial as I thought it would be.

  8. Xstoudi commented on Jan 7, 2026

    @Xstoudi
    Contributor

    Not really fan of documenting the TypedArray properties as it would probably open the door to document every TypedArray method.

    Would you mind if completed this quote from the Buffer doc tho?

    All TypedArray methods are available on Buffers.

  9. silverwind commented on Jan 12, 2026

    @silverwind
    ContributorAuthor

    I think we could write "All TypedArray properties are available on Buffers." to make it clear that not only methods are available, but also instance properties like this one.

    https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/byteLength

  10. silverwind commented on Jan 12, 2026

    @silverwind
    ContributorAuthor
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.docIssues and PRs related to Node.js documentation.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions