-
-
Notifications
You must be signed in to change notification settings - Fork 31.5k
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
Conversation
@targos maybe something like |
doc/api/buffer.md
Outdated
@@ -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. |
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
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
dfc771c
to
c05ab2e
Compare
@aqrln thanks, updated! |
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. |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
Updates on this one? |
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. |
Fixes: #9489
I'm open to suggestions for the commit message that is currently > 50 chars.
Affected core subsystem(s)
doc, buffer