Skip to content

Commit d5b1a4b

Browse files
seishunitaloacasas
authored andcommitted
doc: clarify the behavior of Buffer.byteLength
PR-URL: nodejs#11238 Refs: nodejs#11165 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Michaël Zasso <[email protected]>
1 parent 25226ce commit d5b1a4b

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

doc/api/buffer.md

+4
Original file line numberDiff line numberDiff line change
@@ -618,6 +618,10 @@ Returns the actual byte length of a string. This is not the same as
618618
[`String.prototype.length`] since that returns the number of *characters* in
619619
a string.
620620

621+
*Note* that for `'base64'` and `'hex'`, this function assumes valid input. For
622+
strings that contain non-Base64/Hex-encoded data (e.g. whitespace), the return
623+
value might be greater than the length of a `Buffer` created from the string.
624+
621625
Example:
622626

623627
```js

0 commit comments

Comments
 (0)