Skip to content

Commit e1e02ef

Browse files
seishunMylesBorins
authored andcommitted
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>
1 parent 30d9202 commit e1e02ef

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
@@ -528,6 +528,10 @@ Returns the actual byte length of a string. This is not the same as
528528
[`String.prototype.length`][] since that returns the number of *characters* in
529529
a string.
530530

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

533537
```js

0 commit comments

Comments
 (0)