Skip to content

doc: add note about max string length in buffer.toString #10687

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
wants to merge 1 commit into from

Conversation

targos
Copy link
Member

@targos targos commented Jan 8, 2017

Fixes: #9489

I'm open to suggestions for the commit message that is currently > 50 chars.

  • documentation is changed or added
  • commit message follows commit guidelines
Affected core subsystem(s)

doc, buffer

@nodejs-github-bot nodejs-github-bot added buffer Issues and PRs related to the buffer subsystem. doc Issues and PRs related to the documentations. lts-watch-v6.x labels Jan 8, 2017
@aqrln
Copy link
Contributor

aqrln commented Jan 8, 2017

@targos maybe something like doc: add note about constraints of buffer.toString and elaborate on that in the full commit message.

@@ -1845,6 +1845,10 @@ console.log(buf2.toString('utf8', 0, 3));
console.log(buf2.toString(undefined, 0, 3));
```

_Note_: If the size of the resulting string would exceed an
implementation-specific limit, this method will throw an Error. This limit is
equal to 2^28 - 16 in V8.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing backticks: 2^28 - 16?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ack

buffer.toString throws an Error when the resulting string would be
bigger than `2^28 - 16`.

Fixes: nodejs#9489
@targos
Copy link
Member Author

targos commented Jan 8, 2017

@aqrln thanks, updated!

@lpinca
Copy link
Member

lpinca commented Jan 8, 2017

I wonder if it's better to move the note before the examples.

@@ -1845,6 +1845,10 @@ console.log(buf2.toString('utf8', 0, 3));
console.log(buf2.toString(undefined, 0, 3));
```

_Note_: If the size of the resulting string would exceed an
implementation-specific limit, this method will throw an Error. This limit is
equal to `2^28 - 16` in V8.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm... the note is a bit too vague to be useful. Which implementation-specific limit? What implementation is it specific too? Is the limit fixed and are the variations sufficiently finite to be documented?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is the info about ChakraCore.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be good to either describe or link-to some of the implementation specific variances

@jasnell
Copy link
Member

jasnell commented Mar 24, 2017

Updates on this one?

@jasnell jasnell added the stalled Issues and PRs that are stalled. label Mar 24, 2017
@fhinkel
Copy link
Member

fhinkel commented May 26, 2017

There hasn't been any activity here. I'm closing this. Feel free to reopen (or ping a collaborator) if I closed this in error.

@fhinkel fhinkel closed this May 26, 2017
@targos targos deleted the doc-buffer-tostring-limit branch June 19, 2017 09:14
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
buffer Issues and PRs related to the buffer subsystem. doc Issues and PRs related to the documentations. stalled Issues and PRs that are stalled.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants