buffer.isUtf8(input)
新增于: v19.4.0, v18.14.0
-
input<Buffer> | <ArrayBuffer> | <TypedArray> 待验证的输入。\
input<Buffer> | <ArrayBuffer> | <TypedArray> The input to validate. -
返回:<boolean>
\Returns: <boolean>
如果 input 仅包含有效的 UTF-8 编码数据,此函数返回 true,包括 input 为空的情况。
\This function returns true if input contains only valid UTF-8-encoded data,
including the case in which input is empty.
如果 input 是分离的数组缓冲区则抛出异常。
\Throws if the input is a detached array buffer.