Thanks to visit codestin.com
Credit goes to github.com

Skip to content

ERR_STRING_TOO_LONG on Buffer.toString() #789

@emmercm

Description

@emmercm
  • Are you running the latest version?
  • Have you included sample input, output, error, and expected output?
  • Have you checked if you are using correct configuration?
  • Did you try online tool?
  • Have you checked the docs for helpful APIs and examples?

Description

This exact Buffer.toString() call prevents parsing XML files that are greater than 0x1fffffe8 characters:

xmlData = xmlData.toString();

I'm on Node.js v24.13.1, Apple Silicon macOS 26.3.

Input

The .dat file contained within the "RomVault" zip from this release: https://github.com/Eggmansworld/Datfiles/releases/tag/teknoparrot

Code

I don't believe it's consequential, but the options I'm using are:

new XMLParser({
    ignoreAttributes: false,
    ignoreDeclaration: true,
    ignorePiTags: true,
    parseTagValue: false,
    parseAttributeValue: false,
    attributeNamePrefix: '',
}).parse(buffer)

Output

The Buffer.toString() call throws with:

  • code: ERR_STRING_TOO_LONG
  • message: Cannot create a string longer than 0x1fffffe8 characters

expected data

My expectation is that the library can handle Buffers up to the size that the CPU architecture allows.

Would you like to work on this issue?

  • Yes
  • No

Bookmark this repository for further updates. Visit SoloThought to know about recent features.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions