Skip to content

Commit

Permalink
doc: clarify the behavior of Buffer.byteLength
Browse files Browse the repository at this point in the history
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 MylesBorins committed Mar 9, 2017
1 parent 30d9202 commit e1e02ef
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions doc/api/buffer.md
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,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
Expand Down

0 comments on commit e1e02ef

Please sign in to comment.