mirror of
https://github.com/nodejs/node.git
synced 2026-11-30 11:55:44 -05:00
buffer: add buffer.isUtf8 for utf8 validation
PR-URL: https://github.com/nodejs/node/pull/45947 Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Anna Henningsen <anna@addaleax.net>
This commit is contained in:
1 parent
4063cdcef6
commit
16ee02f2eb
7 files changed
+131
-1
No files matched your search
@@ -5126,6 +5126,17 @@ For code running using Node.js APIs, converting between base64-encoded strings
|
||||
and binary data should be performed using `Buffer.from(str, 'base64')` and
|
||||
`buf.toString('base64')`.**
|
||||
|
||||
### `buffer.isUtf8(input)`
|
||||
|
||||
<!-- YAML
|
||||
added: REPLACEME
|
||||
-->
|
||||
|
||||
* input {Buffer | ArrayBuffer | TypedArray} The input to validate.
|
||||
* Returns: {boolean} Returns `true` if and only if the input is valid UTF-8.
|
||||
|
||||
This function is used to check if input contains UTF-8 code points (characters).
|
||||
|
||||
### `buffer.INSPECT_MAX_BYTES`
|
||||
|
||||
<!-- YAML
|
||||
|
||||
Reference in new issue
Block a user