From b2b61a65e1aeb71d648a8088fe894617299233f6 Mon Sep 17 00:00:00 2001 From: Nikolai Vavilov Date: Wed, 8 Feb 2017 16:45:10 +0200 Subject: [PATCH] doc: clarify the behavior of Buffer.byteLength Ref: https://github.com/nodejs/node/issues/11165 --- doc/api/buffer.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/api/buffer.md b/doc/api/buffer.md index 5d39edbe1321a5..51ea87687db8a4 100644 --- a/doc/api/buffer.md +++ b/doc/api/buffer.md @@ -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