Permalink
Browse files

doc: clarify the behavior of Buffer.byteLength

PR-URL: #11238
Refs: #11165
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
  • Loading branch information...
seishun authored and italoacasas committed Feb 9, 2017
1 parent 25226ce commit d5b1a4b2658cf69d029cc32a71b8e5d487af7a35
Showing with 4 additions and 0 deletions.
  1. +4 −0 doc/api/buffer.md
View
@@ -618,6 +618,10 @@ Returns the actual byte length of a string. This is not the same as
[`String.prototype.length`] since that returns the number of *characters* in
a string.
+*Note* that for `'base64'` and `'hex'`, this function assumes valid input. For
+strings that contain non-Base64/Hex-encoded data (e.g. whitespace), the return
+value might be greater than the length of a `Buffer` created from the string.
+
Example:
```js

0 comments on commit d5b1a4b

Please sign in to comment.