Skip to content

Buffer Base64 Encoding Truncates or Adds Extra Characters #6107

@yunong

Description

@yunong
  • Version: 0.12-5.x
  • Platform: Mac OS X El Capitan
  • Subsystem: Buffer

Encoding and Decoding a new Buffer object with base64 results in garbled or missing data.

> new Buffer('hello', 'base64').toString('base64');
'hell'
> new Buffer('helloIsItMeYourLookingFor', 'base64').toString('base64');
'helloIsItMeYourLookingFo'
> new Buffer('helloIsItMe', 'base64').toString('base64');
'helloIsItMc='
>

Notice how in the first and second example, the last character is missing, and in the third example, there are extra characters appended to the output.

cc/ @trevnorris

Metadata

Metadata

Assignees

No one assigned

    Labels

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

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions