Skip to content

Buffer.from() ignores byteOffset and length parameters #22387

Closed
@njor

Description

@njor
  • Version: v10.9.0
  • Platform: Linux jordan-MS-7817 4.15.0-32-generic net: give better error messages #35-Ubuntu SMP Fri Aug 10 17:58:07 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
  • Subsystem:

According to the documentation, the Buffer.from() function should accept byteOffset and length parameters, but those are actually ignored:

Buffer.from( "hello world" )
<Buffer 68 65 6c 6c 6f 20 77 6f 72 6c 64>
Buffer.from( "hello world", 2, 3 )
<Buffer 68 65 6c 6c 6f 20 77 6f 72 6c 64>

Expected output:

Buffer.from( "hello world", 2, 3 )
<Buffer 6c 6c 6f>

Metadata

Metadata

Assignees

No one assigned

    Labels

    bufferIssues and PRs related to the buffer subsystem.invalidIssues and PRs that are invalid.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions