Browse files

doc: clarify the behavior of Buffer.byteLength

PR-URL: #11238
Refs: #11165
Reviewed-By: James M Snell <>
Reviewed-By: Anna Henningsen <>
Reviewed-By: Michaël Zasso <>
  • 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/
@@ -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.

0 comments on commit d5b1a4b

Please sign in to comment.